manuel/bucky-rdp
A trivial implementation of Reactive Demand Programming
{ "createdAt": "2015-06-15T16:42:02Z", "defaultBranch": "master", "description": "A trivial implementation of Reactive Demand Programming", "fullName": "manuel/bucky-rdp", "homepage": "https://www.npmjs.com/package/bucky-rdp", "language": "JavaScript", "name": "bucky-rdp", "pushedAt": "2015-07-18T11:54:35Z", "stargazersCount": 8, "topics": [], "updatedAt": "2021-11-22T20:50:18Z", "url": "https://github.com/manuel/bucky-rdp"}A trivial implementation of Reactive Demand Programming for Node.js and Browserify.
Supports the following behaviors:
rdp.bConst
Section titled “rdp.bConst”rdp.bConst(value)
While its input signal is active, produces an unchanging value as its output signal. Ignores the actual value of the input signal.
rdp.bPipe
Section titled “rdp.bPipe”rdp.bPipe(b1, ..., bN)
A chain of one or more behaviors.
rdp.bFMap
Section titled “rdp.bFMap”rdp.bFMap(function)
A behavior that applies a function to the value of its input signal, and uses the result as the value of its output signal.
Example
Section titled “Example”var rdp = require("bucky-rdp");
// Create some behaviors for transforming numbers.var bDouble = rdp.bFMap(function(val) { return val * 2; });var bMinusOne = rdp.bFMap(function(val) { return val - 1; });
// Create a pipeline behavior of the two behaviorsvar myBehavior = rdp.bPipe(bDouble, bMinusOne);
// Apply an inactive input signal to the pipeline behaviorvar sigIn = rdp.makeSignal();var sigOut = rdp.apply(myBehavior, sigIn);
// Change the input signal value and watch the output signal changesigIn.setValue(2);console.log(sigOut.getValue()); // Prints 3sigIn.setValue(4);console.log(sigOut.getValue()); // Prints 7sigIn.deactivate();License
Section titled “License”MIT