Skip to content

Commit

Permalink
remove old workaround for missing async require in worker
Browse files Browse the repository at this point in the history
  • Loading branch information
nightwing committed Mar 21, 2018
1 parent ee9f3da commit b82cf28
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions plugins/c9.ide.language.core/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,30 +317,18 @@ function endTime(t, message, indent) {
throw e;
}
}
var handler;
try {
handler = require(path);
if (!handler)
throw new Error("Unable to load required module: " + path);
} catch (e) {
if (isInWebWorker) {
console.error("Could not load language handler " + path + ": " + e);
_self.sender.emit("registered", { path: path, err: e.message });
callback && callback(e);
throw e;
require([path], function(handler) {
if (!handler) {
_self.sender.emit("registered", { path: path, err: "Could not load" });
callback && callback("Could not load");
throw new Error("Could not load language handler " + path);
}
// In ?noworker=1 debugging mode, synchronous require doesn't work
require([path], function(handler) {
if (!handler) {
_self.sender.emit("registered", { path: path, err: "Could not load" });
callback && callback("Could not load");
throw new Error("Could not load language handler " + path);
}
onRegistered(handler);
});
return;
}
onRegistered(handler);
onRegistered(handler);
}, function(e) {
console.error("Could not load language handler " + path + ": " + e);
_self.sender.emit("registered", { path: path, err: e.message });
callback && callback(e);
});
};

this.$createEmitter = function(path) {
Expand Down

0 comments on commit b82cf28

Please sign in to comment.