diff --git a/node_modules/xgplayer/es/plugin/hooksDescriptor.js b/node_modules/xgplayer/es/plugin/hooksDescriptor.js index 395156a..f010488 100644 --- a/node_modules/xgplayer/es/plugin/hooksDescriptor.js +++ b/node_modules/xgplayer/es/plugin/hooksDescriptor.js @@ -40,7 +40,7 @@ function hook(hookName, handler) { } if (this.__hooks && this.__hooks[hookName]) { try { - var preRet = runHooks(this, hookName, handler); + var preRet = runHooks(this, hookName, handler, ...arguments); if (preRet) { if (preRet.then) { preRet.then(function(isContinue) { @@ -54,7 +54,14 @@ function hook(hookName, handler) { callHandler.apply(void 0, [this, handler, preset.next].concat(Array.prototype.slice.call(arguments))); } } else if (preRet === void 0) { - callHandler.apply(void 0, [this, handler, preset.next].concat(Array.prototype.slice.call(arguments))); + var cb = Array.isArray(this.__hooks[hookName]) ? this.__hooks[hookName][this.__hooks[hookName].length - 1] : null + if (typeof cb === 'function') { + if (cb(...arguments)) { + callHandler.apply(void 0, [this, handler, preset.next].concat(Array.prototype.slice.call(arguments))); + } + } else { + callHandler.apply(void 0, [this, handler, preset.next].concat(Array.prototype.slice.call(arguments))); + } } } catch (e) { e.message = "[pluginName: ".concat(this.pluginName, ":").concat(hookName, "] >> ").concat(e.message);