Skip to content
Ulric Wilfred edited this page Jan 30, 2015 · 2 revisions

Description

Represents the Inlet.

Events

  • inlet/update(Any) — fired when inlet receives a value; {inlet, value}

Methods

instance

  • inlet.receive(Any) — receive the value;
  • inlet.stream(KefirStream) — append given stream to the value stream;
  • inlet.toDefault() — manually send default value to this inlet;

Examples

Create node and add an inlet:

var node = new Rpd.Node('core/custom');
var inlet = node.addInlet('core/number', 'num');

Receive a value:

inlet.receive(10);

Receive a stream of values:

inlet.send(Kefir.repeatedly(500, [10, 20, 30]));

Subscribe to inlet/update event:

var model = Rpd.Model.start()
                     .renderWith('html')
                     .attachTo(document.body);
var node = new Rpd.Node('core/custom', 'Custom');
node.event['node/process'].onValue(function(vals) {
    var inlets = vals[0],
    outlets = vals[1],
    prev_inlets = vals[2];
    console.log(inlets, outlets, prev_inlets);
});
Clone this wiki locally