refactor(vast): [PKG-VAST-03] isolate lifecycle ownership checkpoint

This commit is contained in:
Harvey Zhao committed 2026-09-12 09:33:54 +08:00
1 parent d5e1feadf5
commit 4f324a8438
30 files changed
+1453 -383

No files matched your search

+3
View File
@@ -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()
}
},