1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add context/flow/global support to Function node

This commit is contained in:
Nick O'Leary 2015-12-29 22:17:30 +00:00
parent 5ead3342cc
commit 742c470d81

View File

@ -90,7 +90,34 @@ module.exports = function(RED) {
} }
}, },
context: { 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 () { setTimeout: function () {
var func = arguments[0]; var func = arguments[0];