mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fully remove when.js dependency
This commit is contained in:
23
packages/node_modules/node-red/lib/red.js
vendored
23
packages/node_modules/node-red/lib/red.js
vendored
@@ -92,11 +92,32 @@ module.exports = {
|
||||
* @memberof node-red
|
||||
*/
|
||||
start: function() {
|
||||
return runtime.start().then(function() {
|
||||
// The top level red.js has always used 'otherwise' on the promise returned
|
||||
// here. This is a non-standard promise function coming from our early use
|
||||
// of the when.js library.
|
||||
// We want to remove all dependency on when.js as native Promises now exist.
|
||||
// But we have the issue that some embedders of Node-RED may have copied our
|
||||
// top-level red.js a bit too much.
|
||||
//
|
||||
let startPromise = runtime.start().then(function() {
|
||||
if (apiEnabled) {
|
||||
return api.start();
|
||||
}
|
||||
});
|
||||
startPromise._then = startPromise.then;
|
||||
startPromise.then = function(resolve,reject) {
|
||||
var inner = startPromise._then(resolve,reject);
|
||||
inner.otherwise = function(cb) {
|
||||
redUtil.log.error("**********************************************");
|
||||
redUtil.log.error("* Deprecated call to RED.start().otherwise() *");
|
||||
redUtil.log.error("* This will be removed in Node-RED 2.x *");
|
||||
redUtil.log.error("* Use RED.start().catch() instead *")
|
||||
redUtil.log.error("**********************************************");
|
||||
return inner.catch(cb);
|
||||
}
|
||||
return inner;
|
||||
}
|
||||
return startPromise;
|
||||
},
|
||||
/**
|
||||
* Stop the Node-RED application.
|
||||
|
3
packages/node_modules/node-red/red.js
vendored
3
packages/node_modules/node-red/red.js
vendored
@@ -429,7 +429,7 @@ httpsPromise.then(function(startupHttps) {
|
||||
} else {
|
||||
RED.log.info(RED.log._("server.headless-mode"));
|
||||
}
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
RED.log.error(RED.log._("server.failed-to-start"));
|
||||
if (err.stack) {
|
||||
RED.log.error(err.stack);
|
||||
@@ -468,4 +468,5 @@ httpsPromise.then(function(startupHttps) {
|
||||
|
||||
}).catch(function(err) {
|
||||
console.log("Failed to get https settings: " + err);
|
||||
console.log(err.stack)
|
||||
});
|
||||
|
Reference in New Issue
Block a user