Closed shamansir closed 7 years ago
The question is, should outlets send the results always at the same time, just later (sum of the times required for calculations), or separately one by one (so receiving node could trigger several times)
Actually Kefir library may be used to return values asynchronously, i.e. using fromCallback
or fromPromise
when returning the outlet, for example:
Rpd.nodetype('test/from-promise', {
inlets: {
sendLater: { type: 'core/any '}
},
outlets: {
value: { type: 'core/any '}
},
process: function(inlets) {
var valueToSend = inlets.sendLater;
return {
value: Kefir.fromPromise(new Promise(function(resolve, reject) {
setTimeout(function() { resolve(valueToSend); }, 1000);
}));
}
}
})
With Promises or with the same approach as other frameworks do (
done
function)