fsig

1.0.0 • Public • Published

sig

A utility that allows functions to send signals to executers.

Installation

$ npm install sig

Usage

const sig = require("fsig");
 
function* test() {
  yield "a";
  yield "b";
  yield "c";
    return "d";
}
 
console.log("returns:", sig(test).catch(x => {
  console.log("catch:", x);
}).onSignal(x => { // synonym of .catch
  console.log("onSignal:", x);
}).start());
// catch: a
// onSignal: a
// catch: b
// onSignal: b
// catch: c
// onSignal: c
// returns: d
 
 
console.log(sig(test).emitter);
// EventEmitter {}
 
var s = sig(test);
s.emitter.on("signal", function(x) {
  console.log(x)
});
console.log("returns:", s.start());
// a
// b
// c
// returns: d

License

MIT License.

Readme

Keywords

Package Sidebar

Install

npm i fsig

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

1.52 kB

Total Files

3

Last publish

Collaborators

  • firecubez