feature(dom) rm getCurrentFileContent

This commit is contained in:
coderaiser 2014-05-13 10:43:38 -04:00
parent 996686fd27
commit 3b82890b47

View file

@ -965,37 +965,18 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
return ret;
};
/**
* unified way to get current file content
*
* @callback - callback function or data struct {sucess, error}
* @currentFile
*/
this.getCurrentFileContent = function(callback, currentFile) {
var RESTful = DOM.RESTful,
current = currentFile || this.getCurrentFile(),
isDir = this.isCurrentIsDir(currentFile),
path = this.getCurrentPath(current);
if (isDir)
path += '?json';
RESTful.read(path, callback);
return this;
};
/**
* unified way to get current file content
*
* @callback - function({data, name}) {}
* @currentFile
* @param callback
* @param currentFile
*/
this.getCurrentData = function(callback, currentFile) {
var hash,
currentFile = currentFile ? currentFile : Cmd.getCurrentFile(),
path = DOM.getCurrentPath(currentFile),
isDir = DOM.isCurrentIsDir(currentFile),
RESTful = DOM.RESTful,
current = currentFile || DOM.getCurrentFile(),
path = DOM.getCurrentPath(current),
isDir = DOM.isCurrentIsDir(current),
func = function(data) {
var length,
@ -1012,14 +993,14 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
};
if (isDir)
DOM.getCurrentFileContent(func, currentFile);
RESTful.read(path + '?json', func);
else
DOM.checkStorageHash(path, function(error, equal, hashNew) {
Util.ifExec(!error && equal, function() {
DOM.getDataFromStorage(path, callback);
}, function() {
hash = hashNew;
DOM.getCurrentFileContent(func, currentFile);
RESTful.read(path, func);
});
});
};