-
Notifications
You must be signed in to change notification settings - Fork 8
Listeners: js
TekMonks edited this page Jul 21, 2020
·
2 revisions
The JS Listener
The JS listener node is used to implement custom listeners in Javascript. These listeners inject messages based on custom logic or conditions.
The code block below documents the format for the JS Listener node.
"listener": {
"type":"js_listener",
"isMessageGenerator": true,
"js": "<inline javascript code>",
"module": "<path to JS code file>"
}
Only one of js
or module
properties must be defined, depending upon whether the listening logic is written in-line or in a separate Javascript module.
The property isMessageGenerator
must be set to true for this node.
If the module
property is used then the module must implement this function
exports.start = (routeName, listener, messageContainer, _message) => {
....
....
}
The listener must return the message content - regardless of whether inline js
or module
properties are used to implement the logic.
(C) 2018 - 2021 TekMonks