From 5a59096f9b2de0e9a8f924c1222a97cda1934ec7 Mon Sep 17 00:00:00 2001 From: Harvey Zack Date: Thu, 11 Oct 2018 17:17:14 +0800 Subject: [PATCH] update plugin --- src/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index f00465e0e..fe40ea2e7 100644 --- a/src/index.js +++ b/src/index.js @@ -78,7 +78,11 @@ class Artplayer extends Emitter { const args = Array.from(arguments).slice(1); args.unshift(this); - plugin.apply(null, args); + if (typeof plugin.install === 'function') { + plugin.install.apply(plugin, args); + } else if (typeof plugin === 'function') { + plugin.apply(null, args); + } installedPlugins.push(plugin); return this; }