mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 13:21:20 -08:00
add plugin
This commit is contained in:
1 parent
0573cb80b0
commit
d5d16ed709
2 files changed
+14
-1
No files matched your search
@@ -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