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;
|
this.outbound = initialAssertions;
|
||||||
}
|
}
|
||||||
|
|
||||||
get alive(): boolean {
|
|
||||||
return this.exitReason === null;
|
|
||||||
}
|
|
||||||
|
|
||||||
terminateWith(t: Turn, reason: Exclude<ExitReason, null>) {
|
terminateWith(t: Turn, reason: Exclude<ExitReason, null>) {
|
||||||
if (!this.alive) return;
|
if (this.exitReason !== null) return;
|
||||||
this.exitReason = reason;
|
this.exitReason = reason;
|
||||||
this.outbound.forEach((peer, h) => t._retract(peer, h));
|
this.outbound.forEach((peer, h) => t._retract(peer, h));
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(proc: () => void): void {
|
execute(proc: () => void): void {
|
||||||
queueMicrotask(() => {
|
queueMicrotask(() => {
|
||||||
if (!this.alive) return;
|
if (this.exitReason !== null) return;
|
||||||
try {
|
try {
|
||||||
proc();
|
proc();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in New Issue