Make ConcurrentCaller.js importable in electron

This commit is contained in:
Adomas Venčkauskas 2018-07-11 11:27:50 +03:00
parent 53522c2cbe
commit d5c2d887a7

View file

@ -24,9 +24,13 @@
*/
EXPORTED_SYMBOLS = ["ConcurrentCaller"];
Components.utils.import('resource://zotero/require.js');
var Promise = require('resource://zotero/bluebird.js');
if (!(typeof process === 'object' && process + '' === '[object process]')) {
Components.utils.import('resource://zotero/require.js');
var Promise = require('resource://zotero/bluebird.js');
} else {
Promise = require('bluebird');
}
/**
* Call a fixed number of functions at once, queueing the rest until slots
@ -272,3 +276,7 @@ ConcurrentCaller.prototype._log = function (msg) {
this._logger("[ConcurrentCaller] " + (this._id ? `[${this._id}] ` : "") + msg);
}
};
if (typeof process === 'object' && process + '' === '[object process]'){
module.exports = ConcurrentCaller;
}