mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 08:51:20 -08:00
refactor(vast): [PKG-VAST-03] isolate lifecycle ownership checkpoint
This commit is contained in:
1 parent
d5e1feadf5
commit
4f324a8438
30 files changed
+1453
-383
No files matched your search
@@ -24,6 +24,7 @@ export function createVastSdk(options = {}) {
|
||||
this.listeners = new Map()
|
||||
this.destroyCalls = 0
|
||||
state.players.push(this)
|
||||
state.onConstruct?.(this)
|
||||
}
|
||||
|
||||
addEventListener(name, callback) {
|
||||
@@ -32,6 +33,7 @@ export function createVastSdk(options = {}) {
|
||||
if (!this.listeners.has(name))
|
||||
this.listeners.set(name, new Set())
|
||||
this.listeners.get(name).add(callback)
|
||||
state.onListen?.(this)
|
||||
}
|
||||
|
||||
removeEventListener(name, callback) {
|
||||
@@ -52,6 +54,7 @@ export function createVastSdk(options = {}) {
|
||||
this.destroyCalls++
|
||||
if (state.destroyError)
|
||||
throw state.destroyError
|
||||
state.onDestroy?.(this)
|
||||
this.listeners.clear()
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user