UNPKG

wonka

Version:

A fast push & pull stream library for Reason, loosely following the [callbag spec](https://github.com/callbag/callbag)

42 lines (36 loc) 1.08 kB
import * as Curry from "bs-platform/lib/es6/curry.js"; import * as Wonka_helpers from "../wonka_helpers.js"; function publish(source) { var state = /* record */[ /* talkback */Wonka_helpers.talkbackPlaceholder, /* ended */false ]; Curry._1(source, (function (signal) { if (typeof signal === "number") { state[/* ended */1] = true; return /* () */0; } else if (signal.tag) { if (state[/* ended */1]) { return 0; } else { return state[/* talkback */0](/* Pull */0); } } else { var x = signal[0]; state[/* talkback */0] = x; return x(/* Pull */0); } })); return /* record */[/* unsubscribe */(function (param) { if (state[/* ended */1]) { return 0; } else { state[/* ended */1] = true; return state[/* talkback */0](/* Close */1); } })]; } export { publish , } /* No side effect */