ignore #! in the js worker
This commit is contained in:
parent
89963dedac
commit
c9f3abb199
2 changed files with 11 additions and 7 deletions
|
|
@ -16,6 +16,7 @@ oop.inherits(JavaScriptWorker, Mirror);
|
|||
|
||||
this.onUpdate = function() {
|
||||
var value = this.doc.getValue();
|
||||
value = value.replace(/^#!.*\n/, "");
|
||||
|
||||
// var start = new Date();
|
||||
var parser = require("ace/narcissus/jsparse");
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ var require = function(id) {
|
|||
|
||||
var chunks = id.split("/");
|
||||
chunks[0] = require.tlns[chunks[0]] || chunks[0];
|
||||
path = /*require.baseUrl + "/" +*/ chunks.join("/") + ".js"
|
||||
path = /*require.baseUrl + "/" +*/ chunks.join("/") + ".js";
|
||||
|
||||
require.id = id;
|
||||
// console.log("require " + path + " " + id)
|
||||
|
|
@ -29,14 +29,14 @@ var require = function(id) {
|
|||
|
||||
require.modules = {};
|
||||
require.tlns = {};
|
||||
require.baseUrl;
|
||||
require.baseUrl = "";
|
||||
|
||||
var define = function(id, factory) {
|
||||
if (!factory) {
|
||||
factory = id;
|
||||
id = require.id;
|
||||
}
|
||||
if (id.indexOf("text!") == 0)
|
||||
if (id.indexOf("text!") === 0)
|
||||
return;
|
||||
|
||||
require.modules[id] = {
|
||||
|
|
@ -74,7 +74,7 @@ function initSender() {
|
|||
id: callbackId,
|
||||
data: data
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
this.emit = function(name, data) {
|
||||
postMessage({
|
||||
|
|
@ -82,7 +82,8 @@ function initSender() {
|
|||
name: name,
|
||||
data: data
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
}).call(Sender.prototype);
|
||||
|
||||
return new Sender();
|
||||
|
|
@ -93,15 +94,17 @@ var sender;
|
|||
|
||||
onmessage = function(e) {
|
||||
var msg = e.data;
|
||||
if (msg.command)
|
||||
if (msg.command) {
|
||||
main[msg.command].apply(main, msg.args);
|
||||
}
|
||||
else if (msg.init) {
|
||||
initBaseUrls(msg.base, msg.tlns);
|
||||
require("pilot/fixoldbrowsers");
|
||||
sender = initSender();
|
||||
var clazz = require(msg.module)[msg.classname];
|
||||
main = new clazz(sender);
|
||||
} else if (msg.event) {
|
||||
}
|
||||
else if (msg.event) {
|
||||
sender._dispatchEvent(msg.event, msg.data);
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue