fix ?noworker=1 mode

pull/488/merge
nightwing 2018-03-21 20:47:33 +04:00
rodzic bcebf55505
commit 904c80f4e9
2 zmienionych plików z 8 dodań i 17 usunięć

Wyświetl plik

@ -118,23 +118,14 @@ worker.loadPlugin = function(modulePath, contents, callback) {
return callback("Could not load language handler " + modulePath + ": " + e); return callback("Could not load language handler " + modulePath + ": " + e);
} }
} }
var handler;
try { require([modulePath], function(handler) {
handler = require(modulePath);
if (!handler) if (!handler)
throw new Error("Unable to load required module: " + modulePath); return callback("Could not load language handler " + modulePath);
} catch (e) { callback(null, handler);
if (isInWebWorker) }, function(err) {
return callback("Could not load language handler " + modulePath + ": " + e); callback(err);
});
// In ?noworker=1 debugging mode, synchronous require doesn't work
return require([modulePath], function(handler) {
if (!handler)
return callback("Could not load language handler " + modulePath);
callback(null, handler);
});
}
callback(null, handler);
}; };
worker.handlesLanguage = function(language, part) { worker.handlesLanguage = function(language, part) {

Wyświetl plik

@ -213,7 +213,7 @@ var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
var processNext = function() { var processNext = function() {
var msg = _self.messageBuffer.shift(); var msg = _self.messageBuffer.shift();
if (msg.command) if (msg.command && main[msg.command])
main[msg.command].apply(main, msg.args); main[msg.command].apply(main, msg.args);
else if (msg.event) else if (msg.event)
sender._signal(msg.event, msg.data); sender._signal(msg.event, msg.data);