Helper method

This commit is contained in:
Chris 2023-09-13 15:36:06 +10:00
parent 34c7e5f45e
commit d32a38584c

View File

@ -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]]);
}
}
};