Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private handleSignals(
- proc: NodeJS.Process,
- signals: NodeJS.Signals[],
- errorToCallbacks: Map<EProcessError | EProcessSignals, Array<() => void>>,
- ): void {
- let currCloseCbs: Array<() => void> = [() => {}];
- for (const sig of signals) {
- currCloseCbs = errorToCallbacks.get(sig as EProcessSignals); //does this array of callbacks of this iteration<
- proc.on(sig, (): void => {
- ...
- currCloseCbs.map((cb) => cb()); //will be a closure while calling this
- ...
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement