Refactoring to what @nightwing mentioned

pull/117/merge
Tim Robinson 2015-07-13 15:36:08 +00:00 zatwierdzone przez Tim Robinson
rodzic 6c2766b6cc
commit 822eccb18f
2 zmienionych plików z 4 dodań i 18 usunięć

Wyświetl plik

@ -67,7 +67,7 @@
"c9.ide.language.javascript.tern": "#2b0bb024da",
"c9.ide.language.javascript.infer": "#cfec494a3c",
"c9.ide.language.jsonalyzer": "#ba3e0d298c",
"c9.ide.collab": "#e9912adbfc",
"c9.ide.collab": "#234c59a8e9",
"c9.ide.local": "#a9703b630c",
"c9.ide.find": "#6cc6d3379d",
"c9.ide.find.infiles": "#72582de3cd",

Wyświetl plik

@ -124,23 +124,9 @@ define(function(require, exports, module) {
watcher.on("change", function(e) {
var tab = tabManager.findTab(e.path);
if (tab) {
if (collabEnabled && tab.editorType == "ace") {
// Collab is supposed to handle this change
// TODO make this a setting
console.warn("[watchers] change ignored because of Collab", e.path);
/* If the lastChange (added by collab) was greater than 1 second ago set up a watch
To ensure that collab makes this change, if not report an error. The lastChange
check is to avoid a race condition if collab updates before this function runs */
if (!tab.debugData.lastChange || tab.debugData.lastChange < (Date.now() - 1000)) {
if (tab.debugData.changeRegistered) {
clearTimeout(tab.debugData.changeRegistered);
}
tab.debugData.changeRegistered = setTimeout(function() {
emit("changeNotAppliedError", {tab: tab});
}, 5000);
}
return;
}
// If collab picks this up and handles the change it will return false
if (emit("docChange", {tab: tab}) === false)
return
addChangedTab(tab, e.type === "change");
}