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:
@@ -22,7 +22,6 @@
|
||||
|
||||
var i18n = require("i18next");
|
||||
|
||||
var when = require("when");
|
||||
var path = require("path");
|
||||
var fs = require("fs");
|
||||
|
||||
@@ -38,16 +37,16 @@ var initPromise;
|
||||
*/
|
||||
function registerMessageCatalogs(catalogs) {
|
||||
var promises = catalogs.map(function(catalog) {
|
||||
return registerMessageCatalog(catalog.namespace,catalog.dir,catalog.file);
|
||||
return registerMessageCatalog(catalog.namespace,catalog.dir,catalog.file).catch(err => {});
|
||||
});
|
||||
return when.settle(promises);
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a message catalog with i18n.
|
||||
* @memberof @node-red/util_i18n
|
||||
*/
|
||||
function registerMessageCatalog(namespace,dir,file) {
|
||||
async function registerMessageCatalog(namespace,dir,file) {
|
||||
return initPromise.then(function() {
|
||||
return new Promise((resolve,reject) => {
|
||||
resourceMap[namespace] = { basedir:dir, file:file, lngs: []};
|
||||
@@ -147,7 +146,7 @@ function init() {
|
||||
if (!initPromise) {
|
||||
// Keep this as a 'when' promise as top-level red.js uses 'otherwise'
|
||||
// and embedded users of NR may have copied that.
|
||||
initPromise = when.promise((resolve,reject) => {
|
||||
initPromise = new Promise((resolve,reject) => {
|
||||
i18n.use(MessageFileLoader);
|
||||
var opt = {
|
||||
// debug: true,
|
||||
|
@@ -20,7 +20,6 @@
|
||||
"json-stringify-safe": "5.0.1",
|
||||
"jsonata": "1.8.4",
|
||||
"lodash.clonedeep": "^4.5.0",
|
||||
"moment-timezone": "0.5.32",
|
||||
"when": "3.7.8"
|
||||
"moment-timezone": "0.5.32"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user