UNPKG

redioactive

Version:

Reactive streams for chaining overlapping promises.

15 lines (14 loc) 583 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = __importDefault(require("../index")); const wait = (t) => new Promise((r) => setTimeout(() => r(t), t * 500)); const addWait = async (n) => { if (typeof n === 'number') console.log(await wait(n)); }; (0, index_1.default)([1, 2, 3, 4, 5, 6], { bufferSizeMax: 2 }) .doto((x) => console.log('doto', x)) .spout(addWait);