ipc-iterate-back.js
This file
Path
test/fixtures/ipc-iterate-back.js
20 lines · 657 bytes · JavaScript
Last changed by
Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d
History of this fileTake it
Debounce `message` events (#1087)ehmickybefore adoptione8bab97
lines 1–4why, one step back1#!/usr/bin/env node2import process from 'node:process';3import {sendMessage, getOneMessage} from '../../index.js';4import {PARALLEL_COUNT} from '../helpers/parallel.js';Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d
line 5why, one step back5import {isAlwaysTrue, getFirst} from '../helpers/ipc.js';Debounce `message` events (#1087)ehmickybefore adoptione8bab97
line 6why, one step back6Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d
line 7why, one step back7const filter = process.argv[2] === 'true' ? isAlwaysTrue : undefined;Debounce `message` events (#1087)ehmickybefore adoptione8bab97
lines 8–20why, one step back89await sendMessage(await getOneMessage({filter}));1011const messages = Array.from({length: PARALLEL_COUNT}, (_, index) => index + 1);12await Promise.all([13 ...messages.map(message => sendMessage(message)),14 process.emit('message', '.'),15]);1617const promise = process.argv[3] === 'true'18 ? getFirst()19 : getOneMessage({filter});20await sendMessage(await promise);