From d32a38584c8584f1b2bcdf40412638eba9342f47 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 13 Sep 2023 15:36:06 +1000 Subject: [PATCH] Helper method --- web/extensions/core/uiOutput.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 web/extensions/core/uiOutput.js diff --git a/web/extensions/core/uiOutput.js b/web/extensions/core/uiOutput.js new file mode 100644 index 000000000..ad7d231dd --- /dev/null +++ b/web/extensions/core/uiOutput.js @@ -0,0 +1,9 @@ +export function registerUiOutputListener(nodeType, nodeData, message_type, func) { + if (nodeData?.ui_output?.includes(message_type)) { + const onExecuted = nodeType.prototype.onExecuted; + nodeType.prototype.onExecuted = function (message) { + onExecuted?.apply(this, arguments); + if (message[message_type]) func.apply(this, [message[message_type]]); + } + } +}; \ No newline at end of file