-
Notifications
You must be signed in to change notification settings - Fork 0
API Reference
- RED.nodes.Node - the super class all Nodes extend.
- RED.nodes.createNode(node,definition)
- RED.nodes.registerType(type,node)
- RED.library.register(type)
- RED.nodes.addCredentials(id,credentials)
- RED.nodes.getCredentials(id)
- RED.nodes.deleteCredentials(id)
- RED.server.app - the Express instance serving the editor UI
- RED.server.server - the server instance
- RED.nodes.registerType(type,node)
- RED.library.create({})
- RED.nodes.eachNode(cb)
- RED.nodes.eachLink(cb)
- RED.nodes.eachConfig(cb)
- RED.nodes.node(id)
- RED.validators.number()
- RED.validators.regex(re)
- RED.view.redraw
- RED.view.dirty(dirty)
- RED.sidebar.addTab(title,content)
- RED.notify(msg,type)
# RED.nodes.Node
All nodes extend this class. It handles the wiring between nodes and other things. It should not be instantiated directly, rather RED.nodes.createNode should be called from the constructor of the sub-class.
# node.send(msg)
This function causes the message(s) to be sent on to any nodes wired to this one. A node can have multiple outputs and each output can be wired to multiple nodes.
- If
msgis a single message, it is sent on to any nodes wired to the first output. - If
msgis an array, each element of the array is passed to the corresponding output. - If any of these elements is itself an array, each element of that array is sent to the connected nodes in order.
# 'input' event
This event is emitted when the node receives an inbound message. The node should register a listener for this event in order to handle the message. If the node has outputs, it must call send The usual pattern if to create a listener for this event in the nodes constructor.
this.on("input",function(msg) {
var msg = {topic:this.topic,payload:this.payload};
if (msg.payload == "") { msg.payload = Date.now(); }
this.send(msg);
});
# node.close()
# node.log(msg)
# node.warn(msg)
# node.error(msg)
# RED.nodes.createNode(node,definition)
# RED.nodes.registerType(type,node)
# RED.library.register(type)