refactor(edit) Util.exec -> exec

This commit is contained in:
coderaiser 2014-10-10 11:05:15 -04:00
parent 5b46d4a66c
commit 7ca3f1770d

View file

@ -12,6 +12,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
Info = DOM.CurrentInfo,
Files = DOM.Files,
type = Util.type,
exec = Util.exec,
join = CloudCmd.join,
Menu,
@ -30,7 +31,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
ConfigView = {
beforeClose: function() {
isChanged();
Util.exec.ifExist(Menu, 'hide');
exec.ifExist(Menu, 'hide');
},
afterShow: function() {
Ace.clearSelection();
@ -40,7 +41,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
};
function init(callback) {
Util.exec.series([
exec.series([
CloudCmd.View,
load,
Edit.show.bind(null, callback)
@ -48,7 +49,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
}
this.show = function(callback) {
var func = Util.exec.ret(callback);
var func = exec.ret(callback);
if (!Loading) {
Images.showLoad();
@ -174,7 +175,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
isEmmet = extensions.emmet;
if (isEmmet)
Util.exec.if(Emmet, function() {
exec.if(Emmet, function() {
Ace.setOption('enableEmmet', true);
}, function(callback) {
var url;
@ -256,7 +257,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
var isDiff = config.diff,
isZip = config.zip;
Util.exec.if(!isDiff, function(patch) {
exec.if(!isDiff, function(patch) {
var query = '',
MAX_SIZE = CloudFunc.MAX_FILE_SIZE,
patchLength = patch.length,
@ -272,7 +273,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
else
patch = false;
Util.exec.if(!isZip || query, function(equal, data) {
exec.if(!isZip || query, function(equal, data) {
var result = data || patch || Value,
url = path + query;
@ -287,7 +288,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
});
});
}, Util.exec.with(doDiff, path));
}, exec.with(doDiff, path));
});
}
@ -297,7 +298,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
diff(value, function(patch) {
var isAllowed = DOM.Storage.isAllowed();
Util.exec.if(!isAllowed, callback, function(func) {
exec.if(!isAllowed, callback, function(func) {
DOM.checkStorageHash(path, function(error, equal) {
if (!equal)
patch = '';
@ -324,9 +325,9 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
if (!Diff)
Diff = new DiffProto(diff_match_patch);
Util.exec.if(!isAllowed, function() {
exec.if(!isAllowed, function() {
patch = Diff.createPatch(Value, newValue);
Util.exec(callback, patch);
exec(callback, patch);
}, function(func) {
var path = Info.path;
@ -361,10 +362,10 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
if (worker)
worker.send('changeOptions', [JSHintConfig]);
Util.exec(callback);
exec(callback);
};
Util.exec.if(JSHintConfig, func, function() {
exec.if(JSHintConfig, func, function() {
DOM.load.ajax({
url : JSHINT_PATH,
success : function(data) {
@ -431,7 +432,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
Loading = false;
Util.timeEnd(Name + ' load');
Util.exec(callback);
exec(callback);
});
DOM.load.style({