mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 23:51:20 -08:00
add readyCallback
This commit is contained in:
1 parent
92393357c7
commit
03fcc89abf
5 files changed
+22
-12
No files matched your search
@@ -28,7 +28,7 @@ import Mobile from './mobile';
|
||||
let id = 0;
|
||||
const instances = [];
|
||||
export default class Artplayer extends Emitter {
|
||||
constructor(option) {
|
||||
constructor(option, readyCallback) {
|
||||
super();
|
||||
|
||||
this.id = ++id;
|
||||
@@ -65,6 +65,10 @@ export default class Artplayer extends Emitter {
|
||||
this.mobile = new Mobile(this);
|
||||
}
|
||||
|
||||
if (typeof readyCallback === 'function') {
|
||||
this.on('ready', () => readyCallback.call(this));
|
||||
}
|
||||
|
||||
instances.push(this);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -527,7 +527,7 @@ declare class Player {
|
||||
}
|
||||
|
||||
declare class Artplayer extends Player {
|
||||
constructor(option: Option);
|
||||
constructor(option: Option, readyCallback: (this: Artplayer) => void);
|
||||
|
||||
static instances: Artplayer[];
|
||||
static version: string;
|
||||
|
||||
Reference in new issue
Block a user