mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Allow setTimeout in Function node to be promisified in node 8
This commit is contained in:
parent
29cae9975e
commit
85392496e7
@ -187,6 +187,13 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (util.hasOwnProperty('promisify')) {
|
||||||
|
sandbox.setTimeout[util.promisify.custom] = function(after, value) {
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
sandbox.setTimeout(function(){ resolve(value) }, after);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
var context = vm.createContext(sandbox);
|
var context = vm.createContext(sandbox);
|
||||||
try {
|
try {
|
||||||
this.script = vm.createScript(functionText);
|
this.script = vm.createScript(functionText);
|
||||||
|
Loading…
Reference in New Issue
Block a user