UNPKG

the-world-engine

Version:

three.js based, unity like game engine for browser

44 lines 846 B
export class Coroutine { ot; ct; vt; It; gt; xt; constructor(t, i, e) { this.ot = t; this.ct = 0; this.vt = i; this.It = null; this.gt = false; this.xt = e; } get component() { return this.ot; } get elapsedTime() { return this.ct; } set elapsedTime(t) { this.ct = t; } get currentYieldInstruction() { return this.It; } get currentYieldInstructionExist() { return this.gt; } fatchNextInstruction() { const t = this.vt.next(); if (t.done) { this.It = null; this.gt = false; this.xt?.(); this.xt = null; return null; } this.It = t.value; this.gt = true; return this.It; } }