Turn.after

This commit is contained in:
Tony Garnock-Jones 2021-12-12 23:02:58 +01:00
parent 33ac308564
commit 04bbcd25ab
1 changed files with 9 additions and 0 deletions

View File

@ -459,6 +459,15 @@ export class Turn {
if (a !== null) this.enqueue(ref.relay, () => ref.target.message?.(assertion));
}
after(delayMilliseconds: number, a: LocalAction): any {
const facet = this.activeFacet;
const release = facet.preventInertCheck();
return setTimeout(() => {
release();
facet.turn(a);
}, delayMilliseconds);
}
enqueue(relay: Facet, a0: LocalAction): void {
if (this.queues === null) {
throw new Error("Attempt to reuse a committed Turn");