commit
7d7867c149
5 changed files with 24 additions and 20 deletions
|
|
@ -236,7 +236,7 @@ function jsFileList(path, filter) {
|
|||
filter = /_test/;
|
||||
|
||||
return fs.readdirSync(path).map(function(x) {
|
||||
if (x.slice(-3) == ".js" && !filter.test(x))
|
||||
if (x.slice(-3) == ".js" && !filter.test(x) && !/\s/.test(x))
|
||||
return x.slice(0, -3);
|
||||
}).filter(function(x){ return !!x });
|
||||
}
|
||||
|
|
@ -269,9 +269,6 @@ function getWriteFilters(options, projectType) {
|
|||
if (options.filters)
|
||||
filters = filters.concat(options.filters);
|
||||
|
||||
if (projectType == "worker")
|
||||
return filters;
|
||||
|
||||
if (options.noconflict)
|
||||
filters.push(namespace(options.ns));
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ require("./worker/worker_client");
|
|||
require("./keyboard/hash_handler");
|
||||
require("./placeholder");
|
||||
require("./mode/folding/fold_mode");
|
||||
require("./theme/textmate");
|
||||
|
||||
exports.config = require("./config");
|
||||
|
||||
/**
|
||||
|
|
@ -92,6 +94,9 @@ exports.edit = function(el) {
|
|||
onResize: editor.resize.bind(editor)
|
||||
};
|
||||
event.addListener(window, "resize", env.onResize);
|
||||
editor.on("destroy", function() {
|
||||
event.removeListener(window, "resize", env.onResize);
|
||||
});
|
||||
el.env = editor.env = env;
|
||||
return editor;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2105,6 +2105,7 @@ var Editor = function(renderer, session) {
|
|||
**/
|
||||
this.destroy = function() {
|
||||
this.renderer.destroy();
|
||||
this._emit("destroy", this);
|
||||
};
|
||||
|
||||
}).call(Editor.prototype);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
"no use strict";
|
||||
;(function(window) {
|
||||
if (typeof window.window != "undefined" && window.document) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof window != "undefined" && window.document)
|
||||
throw "atempt to load ace worker into main window instead of webWorker";
|
||||
|
||||
var console = {
|
||||
window.console = {
|
||||
log: function() {
|
||||
var msgs = Array.prototype.slice.call(arguments, 0);
|
||||
postMessage({type: "log", data: msgs});
|
||||
|
|
@ -13,11 +14,10 @@ var console = {
|
|||
postMessage({type: "log", data: msgs});
|
||||
}
|
||||
};
|
||||
var window = {
|
||||
console: console
|
||||
};
|
||||
window.window = window;
|
||||
window.ace = window;
|
||||
|
||||
var normalizeModule = function(parentId, moduleName) {
|
||||
window.normalizeModule = function(parentId, moduleName) {
|
||||
// normalize plugin requires
|
||||
if (moduleName.indexOf("!") !== -1) {
|
||||
var chunks = moduleName.split("!");
|
||||
|
|
@ -37,7 +37,7 @@ var normalizeModule = function(parentId, moduleName) {
|
|||
return moduleName;
|
||||
};
|
||||
|
||||
var require = function(parentId, id) {
|
||||
window.require = function(parentId, id) {
|
||||
if (!id.charAt)
|
||||
throw new Error("worker.js require() accepts only (parentId, id) as arguments");
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ var require = function(parentId, id) {
|
|||
require.modules = {};
|
||||
require.tlns = {};
|
||||
|
||||
var define = function(id, deps, factory) {
|
||||
window.define = function(id, deps, factory) {
|
||||
if (arguments.length == 2) {
|
||||
factory = deps;
|
||||
if (typeof id != "string") {
|
||||
|
|
@ -96,11 +96,11 @@ var define = function(id, deps, factory) {
|
|||
};
|
||||
};
|
||||
|
||||
function initBaseUrls(topLevelNamespaces) {
|
||||
window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
|
||||
require.tlns = topLevelNamespaces;
|
||||
}
|
||||
|
||||
function initSender() {
|
||||
window.initSender = function initSender() {
|
||||
|
||||
var EventEmitter = require(null, "ace/lib/event_emitter").EventEmitter;
|
||||
var oop = require(null, "ace/lib/oop");
|
||||
|
|
@ -132,10 +132,10 @@ function initSender() {
|
|||
return new Sender();
|
||||
}
|
||||
|
||||
var main;
|
||||
var sender;
|
||||
window.main = null;
|
||||
window.sender = null;
|
||||
|
||||
onmessage = function(e) {
|
||||
window.onmessage = function(e) {
|
||||
var msg = e.data;
|
||||
if (msg.command) {
|
||||
if (main[msg.command])
|
||||
|
|
@ -154,3 +154,4 @@ onmessage = function(e) {
|
|||
sender._emit(msg.event, msg.data);
|
||||
}
|
||||
};
|
||||
})(this);
|
||||
|
|
@ -203,7 +203,7 @@ var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
|
|||
this.postMessage({type: "event", name: name, data: data});
|
||||
};
|
||||
|
||||
require([mod], function(Main) {
|
||||
config.loadModule(["worker", mod], function(Main) {
|
||||
main = new Main[classname](sender);
|
||||
while (_self.messageBuffer.length)
|
||||
processNext();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue