wonka
Version:
A fast push & pull stream library for Reason, loosely following the [callbag spec](https://github.com/callbag/callbag)
29 lines (23 loc) • 724 B
JavaScript
import * as Block from "bs-platform/lib/es6/block.js";
function interval(p) {
return (function (sink) {
var i = /* record */[/* contents */0];
var id = setInterval((function (param) {
var num = i[0];
i[0] = i[0] + 1 | 0;
return sink(/* Push */Block.__(1, [num]));
}), p);
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
clearInterval(id);
return /* () */0;
} else {
return /* () */0;
}
})]));
});
}
export {
interval ,
}
/* No side effect */