Browse Source

no message

feature/v1.4
xpz2018 4 years ago
parent
commit
68a65e423b
1 changed files with 4 additions and 2 deletions
  1. 6
      pages/index/index.js

6
pages/index/index.js

@ -29,7 +29,7 @@ Scene({
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate() updateManager.applyUpdate()
}) })
// event.on('TabMessage', this, this.onEvent)
event.on('EventMessage', this, this.onEvent)
this.setData({fragment: (app.globalData.safeFragmentHeight + app.globalData.statusBarHeight), safeBottom: app.globalData.safeBottom }) this.setData({fragment: (app.globalData.safeFragmentHeight + app.globalData.statusBarHeight), safeBottom: app.globalData.safeBottom })
this.data.setInter = setInterval(this.fetchMessage, 10000) this.data.setInter = setInterval(this.fetchMessage, 10000)
}, },
@ -48,7 +48,8 @@ Scene({
return false return false
}, },
onEvent: function (message) { onEvent: function (message) {
if (message.what == 99) {
if (message.what == 888) {
this.onUnload()
} }
}, },
fetchMessage: function(){ fetchMessage: function(){
@ -67,6 +68,7 @@ Scene({
this.setData({zIndex: detail}) this.setData({zIndex: detail})
}, },
onUnload: function(){ onUnload: function(){
event.remove('EventMessage', this)
if(this.data.setInter) { if(this.data.setInter) {
clearInterval(this.data.setInter) clearInterval(this.data.setInter)
this.data.setInter = null this.data.setInter = null

Loading…
Cancel
Save