UNPKG

@g20/player

Version:
3 lines (2 loc) 436 B
import{effect as e}from"@g20/reactive";class t{#e;#t;#n=null;constructor(t,n){this.#e=t,this.#t=e((()=>{n(t.frameCount)}))}dispose(){this.#t&&this.#t.dispose()}play(){const e=t=>{this.#n=null,this.#e.update(),this.#n=window.requestAnimationFrame(e)};this.#n=window.requestAnimationFrame(e)}pause(){"number"==typeof this.#n&&(window.cancelAnimationFrame(this.#n),this.#n=null)}}export{t as Player}; //# sourceMappingURL=index.min.js.map