feature(storage) get: callback(data) -> callback(error, data)

This commit is contained in:
coderaiser 2014-06-03 07:23:40 -04:00
parent ce0ce29d6d
commit 243e1f12bf
7 changed files with 11 additions and 12 deletions

View file

@ -272,7 +272,7 @@ var Util, DOM, CloudFunc;
dirPath = CloudFunc.rmLastSlash(dirPath) || '/';
Storage.get(dirPath, function(data) {
Storage.get(dirPath, function(error, data) {
if (!data) {
data = getJSONfromFileTable();
Storage.set(dirPath, data);
@ -380,7 +380,7 @@ var Util, DOM, CloudFunc;
Util.log ('reading dir: "' + cleanPath + '";');
Storage.get(cleanPath, function(json) {
Storage.get(cleanPath, function(error, json) {
var RESTful = DOM.RESTful,
obj = Util.parseJSON(json),
isRefresh = options.refresh,

View file

@ -790,7 +790,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
if (hash && length < ONE_MEGABYTE)
DOM.saveDataToStorage(path, data, hash);
Util.exec(callback, data);
Util.exec(callback, null, data);
};
if (isDir)
@ -1195,8 +1195,8 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
var Storage = DOM.Storage,
nameHash = name + '-hash';
Storage.get(nameHash, function(storeHash) {
var equal, error,
Storage.get(nameHash, function(error, storeHash) {
var equal,
isContain = Util.isContainStr(loadHash, 'error');
if (isContain)
@ -1268,7 +1268,6 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
Storage.get(nameHash, callback);
}
], callback);
}
});
};

View file

@ -104,7 +104,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
Session.setUndoManager(new UndoManager());
}, function(callback) {
Info.getData(function(data) {
Info.getData(function(error, data) {
Value = data;
if (isJS && Session.getUseWorker())
@ -310,7 +310,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
}, function(func) {
var path = Info.path;
DOM.getDataFromStorage(path, function(data) {
DOM.getDataFromStorage(path, function(error, data) {
if (data)
Value = data;

View file

@ -177,7 +177,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
}
function uploadTo(nameModule) {
Info.getData(function(data) {
Info.getData(function(error, data) {
var name = Info.name;
CloudCmd.execFromModule(nameModule, 'uploadFile', {

View file

@ -81,7 +81,7 @@ var Util, DOM;
if (Allowed)
ret = localStorage.getItem(name);
Util.exec(callback, ret);
Util.exec(callback, null, ret);
return this;
},

View file

@ -52,7 +52,7 @@ var CloudCmd, Util, DOM, CloudFunc, Github, cb;
GitHub.autorize = function(callback, code) {
Storage.get('token', function(token) {
Storage.get('token', function(error, token) {
var isContain,
apiURL = CloudFunc.apiURL,
URL = '//' + window.location.host + '/auth/github';

View file

@ -112,7 +112,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
switch(type) {
default:
Info.getData(function(data) {
Info.getData(function(error, data) {
var element = document.createTextNode(data);
/* add margin only for view text documents */
Element.css('margin', '2%');