mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
feature(view) {before,after}{show, close} exec: parallel -> series
This commit is contained in:
parent
178f7415bc
commit
bf71013a37
1 changed files with 31 additions and 11 deletions
|
|
@ -6,23 +6,41 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
CloudCmd.View = ViewProto;
|
||||
|
||||
function ViewProto(CallBack) {
|
||||
var Name = 'View',
|
||||
Loading = false,
|
||||
Events = DOM.Events,
|
||||
Info = DOM.CurrentInfo,
|
||||
Key = CloudCmd.Key,
|
||||
Images = DOM.Images,
|
||||
View = Util.exec.bind(Util),
|
||||
var Name = 'View',
|
||||
Loading = false,
|
||||
FocusWas = false,
|
||||
Events = DOM.Events,
|
||||
Info = DOM.CurrentInfo,
|
||||
Key = CloudCmd.Key,
|
||||
Images = DOM.Images,
|
||||
View = Util.exec.bind(Util),
|
||||
Element, TemplateAudio, Overlay,
|
||||
Config = {
|
||||
beforeShow : function() {
|
||||
beforeShow : function(callback) {
|
||||
Images.hide();
|
||||
Key.unsetBind();
|
||||
DOM.show(Overlay);
|
||||
|
||||
Util.exec(callback);
|
||||
},
|
||||
beforeClose : function() {
|
||||
beforeClose : function(callback) {
|
||||
Key.setBind();
|
||||
DOM.hide(Overlay);
|
||||
|
||||
Util.exec(callback);
|
||||
},
|
||||
afterShow : function(callback) {
|
||||
if (!FocusWas) {
|
||||
FocusWas = true;
|
||||
Element.focus();
|
||||
}
|
||||
|
||||
Util.exec(callback);
|
||||
},
|
||||
afterClose : function(callback) {
|
||||
FocusWas = false;
|
||||
|
||||
Util.exec(callback);
|
||||
},
|
||||
fitToView : true,
|
||||
loop : false,
|
||||
|
|
@ -91,13 +109,15 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
Object.keys(options).forEach(function(name) {
|
||||
var func,
|
||||
isConfig = !!config[name],
|
||||
execParallel = Util.exec.parallel,
|
||||
series = Util.exec.series,
|
||||
item = options[name],
|
||||
isFunc = Util.isFunction(item);
|
||||
|
||||
if (isFunc && isConfig) {
|
||||
func = config[name];
|
||||
config[name] = Util.exec.with(execParallel, [item, func]);
|
||||
config[name] = function() {
|
||||
series([func, item]);
|
||||
};
|
||||
} else {
|
||||
config[name] = options[name];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue