mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(client) refresh: add callback
This commit is contained in:
parent
b40f2e9a7b
commit
c78ad8dc98
1 changed files with 10 additions and 8 deletions
|
|
@ -31,7 +31,7 @@ var Util, DOM, CloudFunc;
|
|||
* }
|
||||
* @param event
|
||||
*/
|
||||
this.loadDir = function(params) {
|
||||
this.loadDir = function(params, callback) {
|
||||
var link, imgPosition, panelChanged, pathParams,
|
||||
isRefresh, panel, history,
|
||||
p = params;
|
||||
|
|
@ -62,7 +62,7 @@ var Util, DOM, CloudFunc;
|
|||
ajaxLoad(link, {
|
||||
refresh : isRefresh,
|
||||
history : history
|
||||
}, panel);
|
||||
}, panel, callback);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -286,7 +286,7 @@ var Util, DOM, CloudFunc;
|
|||
});
|
||||
};
|
||||
|
||||
this.refresh = function(current, panelParam) {
|
||||
this.refresh = function(current, panelParam, callback) {
|
||||
var NEEDREFRESH = true,
|
||||
panel = panelParam || current && current.parentElement,
|
||||
path = DOM.getCurrentDirPath(panel),
|
||||
|
|
@ -300,7 +300,7 @@ var Util, DOM, CloudFunc;
|
|||
isRefresh : NEEDREFRESH,
|
||||
history : false,
|
||||
panel : panel
|
||||
});
|
||||
}, callback);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -310,7 +310,7 @@ var Util, DOM, CloudFunc;
|
|||
* @param pOptions
|
||||
* { refresh, history } - необходимость обновить данные о каталоге
|
||||
*/
|
||||
function ajaxLoad(path, options, panel) {
|
||||
function ajaxLoad(path, options, panel, callback) {
|
||||
var create = function(error, json) {
|
||||
var RESTful = DOM.RESTful,
|
||||
obj = Util.parseJSON(json),
|
||||
|
|
@ -318,10 +318,10 @@ var Util, DOM, CloudFunc;
|
|||
history = options.history;
|
||||
|
||||
if (!isRefresh && json)
|
||||
createFileTable(obj, panel, history);
|
||||
createFileTable(obj, panel, history, callback);
|
||||
else
|
||||
RESTful.read(path, 'json', function(obj) {
|
||||
createFileTable(obj, panel, history);
|
||||
createFileTable(obj, panel, history, callback);
|
||||
Storage.set(path, obj);
|
||||
});
|
||||
};
|
||||
|
|
@ -352,7 +352,7 @@ var Util, DOM, CloudFunc;
|
|||
* @param panelParam
|
||||
* @param history
|
||||
*/
|
||||
function createFileTable(json, panelParam, history) {
|
||||
function createFileTable(json, panelParam, history, callback) {
|
||||
var files,
|
||||
panel = panelParam || DOM.getPanel(),
|
||||
/* getting current element if was refresh */
|
||||
|
|
@ -412,6 +412,8 @@ var Util, DOM, CloudFunc;
|
|||
|
||||
if (name === '..' && dir !== '/')
|
||||
currentToParent(dir);
|
||||
|
||||
Util.exec(callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue