mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
add plugin
This commit is contained in:
1 parent
0573cb80b0
commit
d5d16ed709
2 files changed
+14
-1
No files matched your search
@@ -205,7 +205,7 @@
|
||||
"no-var": 1,
|
||||
"prefer-const": 1,
|
||||
"prefer-destructuring": 1,
|
||||
"prefer-spread": 1,
|
||||
"prefer-spread": 0,
|
||||
"prefer-template": 1,
|
||||
"require-yield": 2,
|
||||
"rest-spread-spacing": 1,
|
||||
|
||||
@@ -70,6 +70,19 @@ class Artplayer extends Emitter {
|
||||
};
|
||||
}
|
||||
|
||||
static use(plugin) {
|
||||
const installedPlugins = this.plugins || (this.plugins = []);
|
||||
if (installedPlugins.indexOf(plugin) > -1) {
|
||||
return this;
|
||||
}
|
||||
|
||||
const args = Array.from(arguments).slice(1);
|
||||
args.unshift(this);
|
||||
plugin.apply(null, args);
|
||||
installedPlugins.push(plugin);
|
||||
return this;
|
||||
}
|
||||
|
||||
init() {
|
||||
this.refs = {
|
||||
container: this.option.container
|
||||
|
||||
Reference in new issue
Block a user