mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add docs for RED.hooks
This commit is contained in:
parent
08148a07b2
commit
6f25337b99
@ -11,6 +11,18 @@ let labelledHooks = { }
|
||||
|
||||
/**
|
||||
* Runtime hooks engine
|
||||
*
|
||||
* The following hooks can be used:
|
||||
*
|
||||
* Message sending
|
||||
* - `onSend` - passed an array of `SendEvent` objects. The messages inside these objects are exactly what the node has passed to `node.send` - meaning there could be duplicate references to the same message object.
|
||||
* - `preRoute` - passed a `SendEvent`
|
||||
* - `preDeliver` - passed a `SendEvent`. The local router has identified the node it is going to send to. At this point, the message has been cloned if needed.
|
||||
* - `postDeliver` - passed a `SendEvent`. The message has been dispatched to be delivered asynchronously (unless the sync delivery flag is set, in which case it would be continue as synchronous delivery)
|
||||
* - `onReceive` - passed a `ReceiveEvent` when a node is about to receive a message
|
||||
* - `postReceive` - passed a `ReceiveEvent` when the message has been given to the node's `input` handler(s)
|
||||
* - `onComplete` - passed a `CompleteEvent` when the node has completed with a message or logged an error
|
||||
*
|
||||
* @mixin @node-red/runtime_hooks
|
||||
*/
|
||||
|
||||
@ -132,25 +144,6 @@ function trigger(hookId, payload, done) {
|
||||
}
|
||||
}
|
||||
|
||||
// add("preSend", function(sendEvents) {
|
||||
// console.log("preSend",JSON.stringify(sendEvents));
|
||||
// })
|
||||
// add("preRoute", function(sendEvent) {
|
||||
// console.log("preRoute",JSON.stringify(sendEvent.msg));
|
||||
// })
|
||||
// add("onSend", function(sendEvent) {
|
||||
// console.log("onSend",JSON.stringify(sendEvent.msg));
|
||||
// })
|
||||
// add("postSend", function(sendEvent) {
|
||||
// console.log("postSend",JSON.stringify(sendEvent.msg));
|
||||
// })
|
||||
// add("onReceive", function(recEvent) {
|
||||
// console.log("onReceive",recEvent.destination.id,JSON.stringify(recEvent.msg))
|
||||
// })
|
||||
// add("postReceive", function(recEvent) {
|
||||
// console.log("postReceive",recEvent.destination.id,JSON.stringify(recEvent.msg))
|
||||
// })
|
||||
|
||||
function clear() {
|
||||
hooks = {}
|
||||
labelledHooks = {}
|
||||
|
Loading…
Reference in New Issue
Block a user