Skip to content
Myr

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 file

Take it

Debounce `message` events (#1087)ehmickybefore adoptione8bab97

lines 1–4why, one step back
1#!/usr/bin/env node
2import 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 back
5import {isAlwaysTrue, getFirst} from '../helpers/ipc.js';

Debounce `message` events (#1087)ehmickybefore adoptione8bab97

line 6why, one step back
6

Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d

line 7why, one step back
7const filter = process.argv[2] === 'true' ? isAlwaysTrue : undefined;

Debounce `message` events (#1087)ehmickybefore adoptione8bab97

lines 8–20why, one step back
8
9await 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);