Tighten
This commit is contained in:
parent
bea357d516
commit
f8e6fc4ab6
8
actor.ts
8
actor.ts
|
@ -40,19 +40,15 @@ export class Actor {
|
|||
this.outbound = initialAssertions;
|
||||
}
|
||||
|
||||
get alive(): boolean {
|
||||
return this.exitReason === null;
|
||||
}
|
||||
|
||||
terminateWith(t: Turn, reason: Exclude<ExitReason, null>) {
|
||||
if (!this.alive) return;
|
||||
if (this.exitReason !== null) return;
|
||||
this.exitReason = reason;
|
||||
this.outbound.forEach((peer, h) => t._retract(peer, h));
|
||||
}
|
||||
|
||||
execute(proc: () => void): void {
|
||||
queueMicrotask(() => {
|
||||
if (!this.alive) return;
|
||||
if (this.exitReason !== null) return;
|
||||
try {
|
||||
proc();
|
||||
} catch (err) {
|
||||
|
|
Loading…
Reference in New Issue