From af2cdf51891b324a97761c6e3a9a8cea0f396f44 Mon Sep 17 00:00:00 2001 From: qiang Date: Wed, 11 Nov 2020 18:42:15 +0800 Subject: [PATCH] build runtime --- packages/uni-app-plus/dist/index.js | 11 +-- packages/uni-mp-alipay/dist/index.js | 11 +-- packages/uni-mp-baidu/dist/index.js | 11 +-- packages/uni-mp-kuaishou/dist/index.js | 11 +-- packages/uni-mp-qq/dist/index.js | 11 +-- packages/uni-mp-toutiao/dist/index.js | 11 +-- packages/uni-mp-weixin/dist/index.js | 79 +-------------------- packages/uni-quickapp-webview/dist/index.js | 11 +-- 8 files changed, 24 insertions(+), 132 deletions(-) diff --git a/packages/uni-app-plus/dist/index.js b/packages/uni-app-plus/dist/index.js index 9410878f9f..51e4127fec 100644 --- a/packages/uni-app-plus/dist/index.js +++ b/packages/uni-app-plus/dist/index.js @@ -1434,15 +1434,10 @@ function getEventChannel (id) { function createApp (vm) { Vue.prototype.getOpenerEventChannel = function () { - switch ("app-plus") { - case 'mp-weixin': - return this.$scope.getOpenerEventChannel() - default : - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ + if (!this.__eventChannel__) { + this.__eventChannel__ = new EventChannel(); } + return this.__eventChannel__ }; const callHook = Vue.prototype.__call_hook; Vue.prototype.__call_hook = function (hook, args) { diff --git a/packages/uni-mp-alipay/dist/index.js b/packages/uni-mp-alipay/dist/index.js index d4dd282bd3..1eee42a53f 100644 --- a/packages/uni-mp-alipay/dist/index.js +++ b/packages/uni-mp-alipay/dist/index.js @@ -2281,15 +2281,10 @@ function parseApp (vm) { function createApp (vm) { Vue.prototype.getOpenerEventChannel = function () { - switch ("mp-alipay") { - case 'mp-weixin': - return this.$scope.getOpenerEventChannel() - default : - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ + if (!this.__eventChannel__) { + this.__eventChannel__ = new EventChannel(); } + return this.__eventChannel__ }; const callHook = Vue.prototype.__call_hook; Vue.prototype.__call_hook = function (hook, args) { diff --git a/packages/uni-mp-baidu/dist/index.js b/packages/uni-mp-baidu/dist/index.js index 86ec293a44..aa1ad7e7c7 100644 --- a/packages/uni-mp-baidu/dist/index.js +++ b/packages/uni-mp-baidu/dist/index.js @@ -1728,15 +1728,10 @@ function parseApp (vm) { function createApp (vm) { Vue.prototype.getOpenerEventChannel = function () { - switch ("mp-baidu") { - case 'mp-weixin': - return this.$scope.getOpenerEventChannel() - default : - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ + if (!this.__eventChannel__) { + this.__eventChannel__ = new EventChannel(); } + return this.__eventChannel__ }; const callHook = Vue.prototype.__call_hook; Vue.prototype.__call_hook = function (hook, args) { diff --git a/packages/uni-mp-kuaishou/dist/index.js b/packages/uni-mp-kuaishou/dist/index.js index 5d59ac5d2b..08ecf75716 100644 --- a/packages/uni-mp-kuaishou/dist/index.js +++ b/packages/uni-mp-kuaishou/dist/index.js @@ -1474,15 +1474,10 @@ function parseApp$1 (vm) { function createApp (vm) { Vue.prototype.getOpenerEventChannel = function () { - switch ("mp-kuaishou") { - case 'mp-weixin': - return this.$scope.getOpenerEventChannel() - default : - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ + if (!this.__eventChannel__) { + this.__eventChannel__ = new EventChannel(); } + return this.__eventChannel__ }; const callHook = Vue.prototype.__call_hook; Vue.prototype.__call_hook = function (hook, args) { diff --git a/packages/uni-mp-qq/dist/index.js b/packages/uni-mp-qq/dist/index.js index 09bb1c2105..fc948a64f4 100644 --- a/packages/uni-mp-qq/dist/index.js +++ b/packages/uni-mp-qq/dist/index.js @@ -1640,15 +1640,10 @@ function parseApp$1 (vm) { function createApp (vm) { Vue.prototype.getOpenerEventChannel = function () { - switch ("mp-qq") { - case 'mp-weixin': - return this.$scope.getOpenerEventChannel() - default : - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ + if (!this.__eventChannel__) { + this.__eventChannel__ = new EventChannel(); } + return this.__eventChannel__ }; const callHook = Vue.prototype.__call_hook; Vue.prototype.__call_hook = function (hook, args) { diff --git a/packages/uni-mp-toutiao/dist/index.js b/packages/uni-mp-toutiao/dist/index.js index 4ca29f08b3..f17e4e9d5f 100644 --- a/packages/uni-mp-toutiao/dist/index.js +++ b/packages/uni-mp-toutiao/dist/index.js @@ -1807,15 +1807,10 @@ function parseApp (vm) { function createApp (vm) { Vue.prototype.getOpenerEventChannel = function () { - switch ("mp-toutiao") { - case 'mp-weixin': - return this.$scope.getOpenerEventChannel() - default : - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ + if (!this.__eventChannel__) { + this.__eventChannel__ = new EventChannel(); } + return this.__eventChannel__ }; const callHook = Vue.prototype.__call_hook; Vue.prototype.__call_hook = function (hook, args) { diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index 706caac10e..e17f348b5e 100644 --- a/packages/uni-mp-weixin/dist/index.js +++ b/packages/uni-mp-weixin/dist/index.js @@ -687,74 +687,6 @@ Component = function (options = {}) { return MPComponent(options) }; -class EventChannel { - constructor (id, events) { - this.id = id; - this.listener = {}; - this.emitCache = {}; - if (events) { - Object.keys(events).forEach(name => { - this.on(name, events[name]); - }); - } - } - - emit (eventName, ...args) { - const fns = this.listener[eventName]; - if (!fns) { - return (this.emitCache[eventName] || (this.emitCache[eventName] = [])).push(args) - } - fns.forEach(opt => { - opt.fn.apply(opt.fn, args); - }); - this.listener[eventName] = fns.filter(opt => opt.type !== 'once'); - } - - on (eventName, fn) { - this._addListener(eventName, 'on', fn); - this._clearCache(eventName); - } - - once (eventName, fn) { - this._addListener(eventName, 'once', fn); - this._clearCache(eventName); - } - - off (eventName, fn) { - const fns = this.listener[eventName]; - if (!fns) { - return - } - if (fn) { - for (let i = 0; i < fns.length;) { - if (fns[i].fn === fn) { - fns.splice(i, 1); - i--; - } - i++; - } - } else { - delete this.listener[eventName]; - } - } - - _clearCache (eventName) { - const cacheArgs = this.emitCache[eventName]; - if (cacheArgs) { - for (; cacheArgs.length > 0;) { - this.emit.apply(this, [eventName].concat(cacheArgs.shift())); - } - } - } - - _addListener (eventName, type, fn) { - (this.listener[eventName] || (this.listener[eventName] = [])).push({ - fn, - type - }); - } -} - const PAGE_EVENT_HOOKS = [ 'onPullDownRefresh', 'onReachBottom', @@ -1485,14 +1417,9 @@ function getEventChannel (id) { function createApp (vm) { Vue.prototype.getOpenerEventChannel = function () { - switch ("mp-weixin") { - case 'mp-weixin': - return this.$scope.getOpenerEventChannel() - default : - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ + // 微信小程序使用自身getOpenerEventChannel + { + return this.$scope.getOpenerEventChannel() } }; const callHook = Vue.prototype.__call_hook; diff --git a/packages/uni-quickapp-webview/dist/index.js b/packages/uni-quickapp-webview/dist/index.js index 8678f1b064..8bfa6f0bf2 100644 --- a/packages/uni-quickapp-webview/dist/index.js +++ b/packages/uni-quickapp-webview/dist/index.js @@ -1552,15 +1552,10 @@ function parseApp (vm) { function createApp (vm) { Vue.prototype.getOpenerEventChannel = function () { - switch ("quickapp-webview") { - case 'mp-weixin': - return this.$scope.getOpenerEventChannel() - default : - if (!this.__eventChannel__) { - this.__eventChannel__ = new EventChannel(); - } - return this.__eventChannel__ + if (!this.__eventChannel__) { + this.__eventChannel__ = new EventChannel(); } + return this.__eventChannel__ }; const callHook = Vue.prototype.__call_hook; Vue.prototype.__call_hook = function (hook, args) { -- GitLab