From 3b82890b4782ec3ed1eecf640d03e6f0e3a0b415 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 13 May 2014 10:43:38 -0400 Subject: [PATCH] feature(dom) rm getCurrentFileContent --- lib/client/dom.js | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index b091ae15..af039bdc 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -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); }); }); };