Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
5f635a4c0This file is pinned to the selected release. Download the original to open it in your design tool.
/**
* Invalidates asynchronous controller continuations after terminal disposal.
*/
export class AppControllerLifecycle {
#disposed = false
#generation = 1
/**
* Captures the generation owned by one asynchronous controller operation.
* @returns {number} Current lifecycle generation.
*/
capture() {
return this.#generation
}
/**
* Reports whether an operation may still publish state.
* @param {number} generation Captured operation generation.
* @returns {boolean} Whether the controller remains active and current.
*/
isCurrent(generation) {
return !this.#disposed && generation === this.#generation
}
/**
* Invalidates every captured operation exactly once.
* @returns {void}
*/
dispose() {
if (this.#disposed) return
this.#disposed = true
this.#generation += 1
}
}
Object.freeze(AppControllerLifecycle.prototype)
Object.freeze(AppControllerLifecycle)