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

Tell ace about Function node globals

Closes #927
This commit is contained in:
Nick O'Leary 2016-07-28 17:14:55 +01:00
parent 1da8712a4a
commit f484156d8e
2 changed files with 23 additions and 1 deletions

View File

@ -1360,6 +1360,14 @@ RED.editor = (function() {
if (options.value) {
session.setValue(options.value,-1);
}
if (options.globals) {
setTimeout(function() {
if (!!session.$worker) {
session.$worker.send("setOptions", [{globals: options.globals}]);
}
},100);
}
return editor;
}
}

View File

@ -91,7 +91,21 @@
this.editor = RED.editor.createEditor({
id: 'node-input-func-editor',
mode: 'ace/mode/javascript',
value: $("#node-input-func").val()
value: $("#node-input-func").val(),
globals: {
msg:true,
context:true,
RED: true,
util: true,
flow: true,
global: true,
console: true,
Buffer: true,
setTimeout: true,
clearTimeout: true,
setInterval: true,
clearInterval: true
}
});
RED.library.create({