use _signal where possible
This commit is contained in:
parent
750d38af6f
commit
9cbcfb35d3
8 changed files with 46 additions and 46 deletions
|
|
@ -191,7 +191,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||||
|
|
||||||
this.row = pos.row;
|
this.row = pos.row;
|
||||||
this.column = pos.column;
|
this.column = pos.column;
|
||||||
this._emit("change", {
|
this._signal("change", {
|
||||||
old: old,
|
old: old,
|
||||||
value: pos
|
value: pos
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||||
first: firstRow,
|
first: firstRow,
|
||||||
last: lastRow
|
last: lastRow
|
||||||
};
|
};
|
||||||
this._emit("update", {data: data});
|
this._signal("update", {data: data});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ var Document = function(text) {
|
||||||
range: range,
|
range: range,
|
||||||
lines: lines
|
lines: lines
|
||||||
};
|
};
|
||||||
this._emit("change", { data: delta });
|
this._signal("change", { data: delta });
|
||||||
return end || range.end;
|
return end || range.end;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -356,7 +356,7 @@ var Document = function(text) {
|
||||||
range: Range.fromPoints(position, end),
|
range: Range.fromPoints(position, end),
|
||||||
text: this.getNewLineCharacter()
|
text: this.getNewLineCharacter()
|
||||||
};
|
};
|
||||||
this._emit("change", { data: delta });
|
this._signal("change", { data: delta });
|
||||||
|
|
||||||
return end;
|
return end;
|
||||||
};
|
};
|
||||||
|
|
@ -390,7 +390,7 @@ var Document = function(text) {
|
||||||
range: Range.fromPoints(position, end),
|
range: Range.fromPoints(position, end),
|
||||||
text: text
|
text: text
|
||||||
};
|
};
|
||||||
this._emit("change", { data: delta });
|
this._signal("change", { data: delta });
|
||||||
|
|
||||||
return end;
|
return end;
|
||||||
};
|
};
|
||||||
|
|
@ -458,7 +458,7 @@ var Document = function(text) {
|
||||||
range: range,
|
range: range,
|
||||||
text: removed
|
text: removed
|
||||||
};
|
};
|
||||||
this._emit("change", { data: delta });
|
this._signal("change", { data: delta });
|
||||||
return range.start;
|
return range.start;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -485,7 +485,7 @@ var Document = function(text) {
|
||||||
nl: this.getNewLineCharacter(),
|
nl: this.getNewLineCharacter(),
|
||||||
lines: removed
|
lines: removed
|
||||||
};
|
};
|
||||||
this._emit("change", { data: delta });
|
this._signal("change", { data: delta });
|
||||||
return removed;
|
return removed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -508,7 +508,7 @@ var Document = function(text) {
|
||||||
range: range,
|
range: range,
|
||||||
text: this.getNewLineCharacter()
|
text: this.getNewLineCharacter()
|
||||||
};
|
};
|
||||||
this._emit("change", { data: delta });
|
this._signal("change", { data: delta });
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ var EditSession = function(text, mode) {
|
||||||
|
|
||||||
config.resetOptions(this);
|
config.resetOptions(this);
|
||||||
this.setMode(mode);
|
this.setMode(mode);
|
||||||
config._emit("session", this);
|
config._signal("session", this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -269,7 +269,7 @@ var EditSession = function(text, mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bgTokenizer.$updateOnChange(delta);
|
this.bgTokenizer.$updateOnChange(delta);
|
||||||
this._emit("change", e);
|
this._signal("change", e);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -528,7 +528,7 @@ var EditSession = function(text, mode) {
|
||||||
if (!this.$decorations[row])
|
if (!this.$decorations[row])
|
||||||
this.$decorations[row] = "";
|
this.$decorations[row] = "";
|
||||||
this.$decorations[row] += " " + className;
|
this.$decorations[row] += " " + className;
|
||||||
this._emit("changeBreakpoint", {});
|
this._signal("changeBreakpoint", {});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -540,7 +540,7 @@ var EditSession = function(text, mode) {
|
||||||
**/
|
**/
|
||||||
this.removeGutterDecoration = function(row, className) {
|
this.removeGutterDecoration = function(row, className) {
|
||||||
this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
|
this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
|
||||||
this._emit("changeBreakpoint", {});
|
this._signal("changeBreakpoint", {});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -563,7 +563,7 @@ var EditSession = function(text, mode) {
|
||||||
for (var i=0; i<rows.length; i++) {
|
for (var i=0; i<rows.length; i++) {
|
||||||
this.$breakpoints[rows[i]] = "ace_breakpoint";
|
this.$breakpoints[rows[i]] = "ace_breakpoint";
|
||||||
}
|
}
|
||||||
this._emit("changeBreakpoint", {});
|
this._signal("changeBreakpoint", {});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -571,7 +571,7 @@ var EditSession = function(text, mode) {
|
||||||
**/
|
**/
|
||||||
this.clearBreakpoints = function() {
|
this.clearBreakpoints = function() {
|
||||||
this.$breakpoints = [];
|
this.$breakpoints = [];
|
||||||
this._emit("changeBreakpoint", {});
|
this._signal("changeBreakpoint", {});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -588,7 +588,7 @@ var EditSession = function(text, mode) {
|
||||||
this.$breakpoints[row] = className;
|
this.$breakpoints[row] = className;
|
||||||
else
|
else
|
||||||
delete this.$breakpoints[row];
|
delete this.$breakpoints[row];
|
||||||
this._emit("changeBreakpoint", {});
|
this._signal("changeBreakpoint", {});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -599,7 +599,7 @@ var EditSession = function(text, mode) {
|
||||||
**/
|
**/
|
||||||
this.clearBreakpoint = function(row) {
|
this.clearBreakpoint = function(row) {
|
||||||
delete this.$breakpoints[row];
|
delete this.$breakpoints[row];
|
||||||
this._emit("changeBreakpoint", {});
|
this._signal("changeBreakpoint", {});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -626,10 +626,10 @@ var EditSession = function(text, mode) {
|
||||||
|
|
||||||
if (inFront) {
|
if (inFront) {
|
||||||
this.$frontMarkers[id] = marker;
|
this.$frontMarkers[id] = marker;
|
||||||
this._emit("changeFrontMarker")
|
this._signal("changeFrontMarker")
|
||||||
} else {
|
} else {
|
||||||
this.$backMarkers[id] = marker;
|
this.$backMarkers[id] = marker;
|
||||||
this._emit("changeBackMarker")
|
this._signal("changeBackMarker")
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
|
@ -652,10 +652,10 @@ var EditSession = function(text, mode) {
|
||||||
|
|
||||||
if (inFront) {
|
if (inFront) {
|
||||||
this.$frontMarkers[id] = marker;
|
this.$frontMarkers[id] = marker;
|
||||||
this._emit("changeFrontMarker")
|
this._signal("changeFrontMarker")
|
||||||
} else {
|
} else {
|
||||||
this.$backMarkers[id] = marker;
|
this.$backMarkers[id] = marker;
|
||||||
this._emit("changeBackMarker")
|
this._signal("changeBackMarker")
|
||||||
}
|
}
|
||||||
|
|
||||||
return marker;
|
return marker;
|
||||||
|
|
@ -676,7 +676,7 @@ var EditSession = function(text, mode) {
|
||||||
var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
|
var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
|
||||||
if (marker) {
|
if (marker) {
|
||||||
delete (markers[markerId]);
|
delete (markers[markerId]);
|
||||||
this._emit(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
|
this._signal(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -728,7 +728,7 @@ var EditSession = function(text, mode) {
|
||||||
**/
|
**/
|
||||||
this.setAnnotations = function(annotations) {
|
this.setAnnotations = function(annotations) {
|
||||||
this.$annotations = annotations;
|
this.$annotations = annotations;
|
||||||
this._emit("changeAnnotation", {});
|
this._signal("changeAnnotation", {});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -858,7 +858,7 @@ var EditSession = function(text, mode) {
|
||||||
this.onReloadTokenizer = function(e) {
|
this.onReloadTokenizer = function(e) {
|
||||||
var rows = e.data;
|
var rows = e.data;
|
||||||
this.bgTokenizer.start(rows.first);
|
this.bgTokenizer.start(rows.first);
|
||||||
this._emit("tokenizerUpdate", e);
|
this._signal("tokenizerUpdate", e);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$modes = {};
|
this.$modes = {};
|
||||||
|
|
@ -937,7 +937,7 @@ var EditSession = function(text, mode) {
|
||||||
this.bgTokenizer = new BackgroundTokenizer(tokenizer);
|
this.bgTokenizer = new BackgroundTokenizer(tokenizer);
|
||||||
var _self = this;
|
var _self = this;
|
||||||
this.bgTokenizer.addEventListener("update", function(e) {
|
this.bgTokenizer.addEventListener("update", function(e) {
|
||||||
_self._emit("tokenizerUpdate", e);
|
_self._signal("tokenizerUpdate", e);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.bgTokenizer.setTokenizer(tokenizer);
|
this.bgTokenizer.setTokenizer(tokenizer);
|
||||||
|
|
@ -1563,7 +1563,7 @@ var EditSession = function(text, mode) {
|
||||||
this.$updateWrapData(0, len - 1);
|
this.$updateWrapData(0, len - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._emit("changeWrapMode");
|
this._signal("changeWrapMode");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1594,7 +1594,7 @@ var EditSession = function(text, mode) {
|
||||||
};
|
};
|
||||||
this.$modified = true;
|
this.$modified = true;
|
||||||
// This will force a recalculation of the wrap limit
|
// This will force a recalculation of the wrap limit
|
||||||
this._emit("changeWrapMode");
|
this._signal("changeWrapMode");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1616,7 +1616,7 @@ var EditSession = function(text, mode) {
|
||||||
if (this.$useWrapMode) {
|
if (this.$useWrapMode) {
|
||||||
this.$updateWrapData(0, this.getLength() - 1);
|
this.$updateWrapData(0, this.getLength() - 1);
|
||||||
this.$resetRowCache(0);
|
this.$resetRowCache(0);
|
||||||
this._emit("changeWrapLimit");
|
this._signal("changeWrapLimit");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2507,7 +2507,7 @@ config.defineOptions(EditSession.prototype, "session", {
|
||||||
initialValue: "auto"
|
initialValue: "auto"
|
||||||
},
|
},
|
||||||
firstLineNumber: {
|
firstLineNumber: {
|
||||||
set: function() {this._emit("changeBreakpoint");},
|
set: function() {this._signal("changeBreakpoint");},
|
||||||
initialValue: 1
|
initialValue: 1
|
||||||
},
|
},
|
||||||
useWorker: {
|
useWorker: {
|
||||||
|
|
@ -2528,13 +2528,13 @@ config.defineOptions(EditSession.prototype, "session", {
|
||||||
this.$modified = true;
|
this.$modified = true;
|
||||||
this.$rowLengthCache = [];
|
this.$rowLengthCache = [];
|
||||||
this.$tabSize = tabSize;
|
this.$tabSize = tabSize;
|
||||||
this._emit("changeTabSize");
|
this._signal("changeTabSize");
|
||||||
},
|
},
|
||||||
initialValue: 4,
|
initialValue: 4,
|
||||||
handlesSet: true
|
handlesSet: true
|
||||||
},
|
},
|
||||||
overwrite: {
|
overwrite: {
|
||||||
set: function(val) {this._emit("changeOverwrite");},
|
set: function(val) {this._signal("changeOverwrite");},
|
||||||
initialValue: false
|
initialValue: false
|
||||||
},
|
},
|
||||||
newLineMode: {
|
newLineMode: {
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ var Editor = function(renderer, session) {
|
||||||
|
|
||||||
this.setSession(session || new EditSession(""));
|
this.setSession(session || new EditSession(""));
|
||||||
config.resetOptions(this);
|
config.resetOptions(this);
|
||||||
config._emit("editor", this);
|
config._signal("editor", this);
|
||||||
};
|
};
|
||||||
|
|
||||||
(function(){
|
(function(){
|
||||||
|
|
@ -384,7 +384,7 @@ var Editor = function(renderer, session) {
|
||||||
this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
|
this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
|
||||||
this.renderer.updateFull();
|
this.renderer.updateFull();
|
||||||
|
|
||||||
this._emit("changeSession", {
|
this._signal("changeSession", {
|
||||||
session: session,
|
session: session,
|
||||||
oldSession: oldSession
|
oldSession: oldSession
|
||||||
});
|
});
|
||||||
|
|
@ -617,7 +617,7 @@ var Editor = function(renderer, session) {
|
||||||
lastRow = Infinity;
|
lastRow = Infinity;
|
||||||
this.renderer.updateLines(range.start.row, lastRow);
|
this.renderer.updateLines(range.start.row, lastRow);
|
||||||
|
|
||||||
this._emit("change", e);
|
this._signal("change", e);
|
||||||
|
|
||||||
// update cursor because tab characters can influence the cursor position
|
// update cursor because tab characters can influence the cursor position
|
||||||
this.$cursorChange();
|
this.$cursorChange();
|
||||||
|
|
@ -650,7 +650,7 @@ var Editor = function(renderer, session) {
|
||||||
|
|
||||||
this.$highlightBrackets();
|
this.$highlightBrackets();
|
||||||
this.$updateHighlightActiveLine();
|
this.$updateHighlightActiveLine();
|
||||||
this._emit("changeSelection");
|
this._signal("changeSelection");
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$updateHighlightActiveLine = function() {
|
this.$updateHighlightActiveLine = function() {
|
||||||
|
|
@ -675,7 +675,7 @@ var Editor = function(renderer, session) {
|
||||||
session.$highlightLineMarker.start.row = highlight.row;
|
session.$highlightLineMarker.start.row = highlight.row;
|
||||||
session.$highlightLineMarker.end.row = highlight.row;
|
session.$highlightLineMarker.end.row = highlight.row;
|
||||||
session.$highlightLineMarker.start.column = highlight.column;
|
session.$highlightLineMarker.start.column = highlight.column;
|
||||||
session._emit("changeBackMarker");
|
session._signal("changeBackMarker");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -698,7 +698,7 @@ var Editor = function(renderer, session) {
|
||||||
var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp();
|
var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp();
|
||||||
this.session.highlight(re);
|
this.session.highlight(re);
|
||||||
|
|
||||||
this._emit("changeSelection");
|
this._signal("changeSelection");
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$getSelectionHighLightRegexp = function() {
|
this.$getSelectionHighLightRegexp = function() {
|
||||||
|
|
@ -2302,7 +2302,7 @@ var Editor = function(renderer, session) {
|
||||||
**/
|
**/
|
||||||
this.destroy = function() {
|
this.destroy = function() {
|
||||||
this.renderer.destroy();
|
this.renderer.destroy();
|
||||||
this._emit("destroy", this);
|
this._signal("destroy", this);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2379,7 +2379,7 @@ config.defineOptions(Editor.prototype, "editor", {
|
||||||
selectionStyle: {
|
selectionStyle: {
|
||||||
set: function(style) {
|
set: function(style) {
|
||||||
this.onSelectionChange();
|
this.onSelectionChange();
|
||||||
this._emit("changeSelectionStyle", {data: style});
|
this._signal("changeSelectionStyle", {data: style});
|
||||||
},
|
},
|
||||||
initialValue: "line"
|
initialValue: "line"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ var EditSession = require("./edit_session").EditSession;
|
||||||
this.$onRemoveRange(removed);
|
this.$onRemoveRange(removed);
|
||||||
|
|
||||||
if (this.rangeCount > 1 && !this.inMultiSelectMode) {
|
if (this.rangeCount > 1 && !this.inMultiSelectMode) {
|
||||||
this._emit("multiSelect");
|
this._signal("multiSelect");
|
||||||
this.inMultiSelectMode = true;
|
this.inMultiSelectMode = true;
|
||||||
this.session.$undoSelect = false;
|
this.session.$undoSelect = false;
|
||||||
this.rangeList.attach(this.session);
|
this.rangeList.attach(this.session);
|
||||||
|
|
@ -150,7 +150,7 @@ var EditSession = require("./edit_session").EditSession;
|
||||||
this.$onAddRange = function(range) {
|
this.$onAddRange = function(range) {
|
||||||
this.rangeCount = this.rangeList.ranges.length;
|
this.rangeCount = this.rangeList.ranges.length;
|
||||||
this.ranges.unshift(range);
|
this.ranges.unshift(range);
|
||||||
this._emit("addRange", {range: range});
|
this._signal("addRange", {range: range});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$onRemoveRange = function(removed) {
|
this.$onRemoveRange = function(removed) {
|
||||||
|
|
@ -166,11 +166,11 @@ var EditSession = require("./edit_session").EditSession;
|
||||||
this.ranges.splice(index, 1);
|
this.ranges.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._emit("removeRange", {ranges: removed});
|
this._signal("removeRange", {ranges: removed});
|
||||||
|
|
||||||
if (this.rangeCount == 0 && this.inMultiSelectMode) {
|
if (this.rangeCount == 0 && this.inMultiSelectMode) {
|
||||||
this.inMultiSelectMode = false;
|
this.inMultiSelectMode = false;
|
||||||
this._emit("singleSelect");
|
this._signal("singleSelect");
|
||||||
this.session.$undoSelect = true;
|
this.session.$undoSelect = true;
|
||||||
this.rangeList.detach(this.session);
|
this.rangeList.detach(this.session);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ window.onmessage = function(e) {
|
||||||
main = new clazz(sender);
|
main = new clazz(sender);
|
||||||
}
|
}
|
||||||
else if (msg.event && sender) {
|
else if (msg.event && sender) {
|
||||||
sender._emit(msg.event, msg.data);
|
sender._signal(msg.event, msg.data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})(this);
|
})(this);
|
||||||
|
|
@ -96,7 +96,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "event":
|
case "event":
|
||||||
this._emit(msg.name, {data: msg.data});
|
this._signal(msg.name, {data: msg.data});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "call":
|
case "call":
|
||||||
|
|
@ -121,7 +121,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.terminate = function() {
|
this.terminate = function() {
|
||||||
this._emit("terminate", {});
|
this._signal("terminate", {});
|
||||||
this.deltaQueue = null;
|
this.deltaQueue = null;
|
||||||
this.$worker.terminate();
|
this.$worker.terminate();
|
||||||
this.$worker = null;
|
this.$worker = null;
|
||||||
|
|
@ -217,7 +217,7 @@ var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
|
||||||
if (msg.command)
|
if (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._emit(msg.event, msg.data);
|
sender._signal(msg.event, msg.data);
|
||||||
};
|
};
|
||||||
|
|
||||||
sender.postMessage = function(msg) {
|
sender.postMessage = function(msg) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue