diff --git a/litemall-wx/app.js b/litemall-wx/app.js index 1fb78e95..d9b0acc9 100644 --- a/litemall-wx/app.js +++ b/litemall-wx/app.js @@ -4,6 +4,17 @@ var user = require('./utils/user.js'); App({ onLaunch: function() { + Promise.prototype.finally = function(callback){ + let P = this.constructor; + return this.then( + value => { + P.resolve(callback()).then(() => value) + }, + reason => { + P.resolve(callback()).then(() => { throw reason }) + } + ) + } const updateManager = wx.getUpdateManager(); wx.getUpdateManager().onUpdateReady(function() { wx.showModal({ diff --git a/renard-wx/app.js b/renard-wx/app.js index 1fb78e95..2c55319f 100644 --- a/renard-wx/app.js +++ b/renard-wx/app.js @@ -4,7 +4,20 @@ var user = require('./utils/user.js'); App({ onLaunch: function() { + Promise.prototype.finally = function(callback){ + let P = this.constructor; + return this.then( + value => { + P.resolve(callback()).then(() => value) + }, + reason => { + P.resolve(callback()).then(() => { throw reason }) + } + ) + } + const updateManager = wx.getUpdateManager(); + wx.getUpdateManager().onUpdateReady(function() { wx.showModal({ title: '更新提示',