From 742c470d81f3b1aab71b1df3b4a752d8875ee75d Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 29 Dec 2015 22:17:30 +0000 Subject: [PATCH] Add context/flow/global support to Function node --- nodes/core/core/80-function.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/nodes/core/core/80-function.js b/nodes/core/core/80-function.js index b771d1c91..9ddcbdbe1 100644 --- a/nodes/core/core/80-function.js +++ b/nodes/core/core/80-function.js @@ -90,7 +90,34 @@ module.exports = function(RED) { } }, context: { - global:RED.settings.functionGlobalContext || {} + set: function() { + node.context().set.apply(node,arguments); + }, + get: function() { + return node.context().get.apply(node,arguments); + }, + get global() { + return node.context().global; + }, + get flow() { + return node.context().flow; + } + }, + flow: { + set: function() { + node.context().flow.set.apply(node,arguments); + }, + get: function() { + return node.context().flow.get.apply(node,arguments); + } + }, + global: { + set: function() { + node.context().global.set.apply(node,arguments); + }, + get: function() { + return node.context().global.get.apply(node,arguments); + } }, setTimeout: function () { var func = arguments[0];