mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
No longer pass in date
This commit is contained in:
parent
7fdd7f89e4
commit
542ef7d506
@ -71,16 +71,7 @@ module.exports = function(RED) {
|
|||||||
"status:__node__.status,"+
|
"status:__node__.status,"+
|
||||||
"send:function(msgs){ __node__.send(__msgid__,msgs);}"+
|
"send:function(msgs){ __node__.send(__msgid__,msgs);}"+
|
||||||
"};\n"+
|
"};\n"+
|
||||||
"var innerFunc = (msg) => {\n" +
|
|
||||||
this.func+"\n"+
|
this.func+"\n"+
|
||||||
"};\n" +
|
|
||||||
"let output;\n" +
|
|
||||||
"try {\n" +
|
|
||||||
" const result = innerFunc(msg);\n" +
|
|
||||||
" return JSON.stringify({ type: 'msg', result });\n" +
|
|
||||||
"} catch (e) {\n" +
|
|
||||||
" return JSON.stringify({ type: 'error', message: e.message, stack: e.stack });\n" +
|
|
||||||
"}" +
|
|
||||||
"})(msg);";
|
"})(msg);";
|
||||||
this.topic = n.topic;
|
this.topic = n.topic;
|
||||||
this.outstandingTimers = [];
|
this.outstandingTimers = [];
|
||||||
@ -89,7 +80,7 @@ module.exports = function(RED) {
|
|||||||
console: console,
|
console: console,
|
||||||
util:util,
|
util:util,
|
||||||
//Buffer:Buffer,
|
//Buffer:Buffer,
|
||||||
Date: Date,
|
//Date: Date,
|
||||||
RED: {
|
RED: {
|
||||||
util: RED.util
|
util: RED.util
|
||||||
},
|
},
|
||||||
@ -218,18 +209,9 @@ module.exports = function(RED) {
|
|||||||
try {
|
try {
|
||||||
var start = process.hrtime();
|
var start = process.hrtime();
|
||||||
sandbox.msg = msg;
|
sandbox.msg = msg;
|
||||||
const logger = msg.logger;
|
|
||||||
|
|
||||||
const vm2Instance = new vm2.VM({ sandbox });
|
const vm2Instance = new vm2.VM({ sandbox });
|
||||||
const result = JSON.parse(vm2Instance.run(functionText));
|
const result = vm2Instance.run(functionText);
|
||||||
if(result.type === 'error') {
|
sendResults(this,msg._msgid, result);
|
||||||
const error = new Error(result.message);
|
|
||||||
error.stack = result.stack;
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
|
|
||||||
result.result.logger = logger;
|
|
||||||
sendResults(this,msg._msgid, result.result);
|
|
||||||
|
|
||||||
var duration = process.hrtime(start);
|
var duration = process.hrtime(start);
|
||||||
var converted = Math.floor((duration[0] * 1e9 + duration[1])/10000)/100;
|
var converted = Math.floor((duration[0] * 1e9 + duration[1])/10000)/100;
|
||||||
|
2712
package-lock.json
generated
2712
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@servisbot/node-red",
|
"name": "@servisbot/node-red",
|
||||||
"version": "0.18.7-patch-4",
|
"version": "0.18.7-patch-5",
|
||||||
"description": "A visual tool for wiring the Internet of Things",
|
"description": "A visual tool for wiring the Internet of Things",
|
||||||
"homepage": "http://nodered.org",
|
"homepage": "http://nodered.org",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user