Turn.every
This commit is contained in:
parent
c20cab0bba
commit
83cc561cce
|
@ -450,6 +450,21 @@ export class Turn {
|
||||||
if (a !== null) this.enqueue(ref.relay, () => ref.target.message?.(assertion));
|
if (a !== null) this.enqueue(ref.relay, () => ref.target.message?.(assertion));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
every(periodMilliseconds: number, a: LocalAction): any {
|
||||||
|
const facet = this.activeFacet;
|
||||||
|
facet.preventInertCheck();
|
||||||
|
let handle: any = setInterval(() => {
|
||||||
|
facet.turn(a);
|
||||||
|
}, periodMilliseconds);
|
||||||
|
facet.onStop(() => {
|
||||||
|
if (handle !== null) {
|
||||||
|
clearInterval(handle);
|
||||||
|
handle = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
after(delayMilliseconds: number, a: LocalAction): any {
|
after(delayMilliseconds: number, a: LocalAction): any {
|
||||||
const facet = this.activeFacet;
|
const facet = this.activeFacet;
|
||||||
const release = facet.preventInertCheck();
|
const release = facet.preventInertCheck();
|
||||||
|
|
Loading…
Reference in New Issue