Alter atExit to yield callback for removing the hook
This commit is contained in:
parent
0a0e8050cb
commit
c73d4df2f2
|
@ -138,8 +138,12 @@ export class Actor {
|
|||
return this._dataflowGraph;
|
||||
}
|
||||
|
||||
atExit(a: LocalAction): void {
|
||||
atExit(a: LocalAction): () => void {
|
||||
this.exitHooks.push(a);
|
||||
return () => {
|
||||
const i = this.exitHooks.indexOf(a);
|
||||
if (i !== -1) this.exitHooks.splice(i, 1);
|
||||
};
|
||||
}
|
||||
|
||||
_terminateWith(reason: Exclude<ExitReason, null>) {
|
||||
|
|
Loading…
Reference in New Issue