To simplify flows, I would like to call a function node f2 and send a message from f2, from function node f1. What is your opinion of the following solution?
[
{
"id": "e0daef4e151b606a",
"type": "inject",
"z": "657242a17ce34e01",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 500,
"y": 360,
"wires": [
[
"5c4a27309369d270"
]
]
},
{
"id": "5c4a27309369d270",
"type": "function",
"z": "657242a17ce34e01",
"name": "print",
"func": "var a = global.get(\"a\")();\na.f1();\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 690,
"y": 360,
"wires": [
[]
]
},
{
"id": "882e52c58f558266",
"type": "function",
"z": "657242a17ce34e01",
"name": "f1",
"func": "let a = {};\na.f1 = function() {\n node.warn(\"Hello world\");\n}\n\nglobal.set(\"a\", function () {\n return a;\n});\n\n\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 690,
"y": 300,
"wires": [
[
"9a7c3d0aca152e65"
]
]
},
{
"id": "ec9b3b646962f57c",
"type": "inject",
"z": "657242a17ce34e01",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 510,
"y": 300,
"wires": [
[
"882e52c58f558266"
]
]
},
{
"id": "9a7c3d0aca152e65",
"type": "debug",
"z": "657242a17ce34e01",
"name": "debug 55",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 880,
"y": 300,
"wires": []
}
]