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);
}
}
var handler;
try {
handler = require(modulePath);
require([modulePath], function(handler) {
if (!handler)
throw new Error("Unable to load required module: " + modulePath);
} catch (e) {
if (isInWebWorker)
return callback("Could not load language handler " + modulePath + ": " + e);
// 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);
return callback("Could not load language handler " + modulePath);
callback(null, handler);
}, function(err) {
callback(err);
});
};
worker.handlesLanguage = function(language, part) {

Wyświetl plik

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