feature(view) {before,after}{show, close} exec: parallel -> series

This commit is contained in:
coderaiser 2014-06-05 06:21:09 -04:00
parent 178f7415bc
commit bf71013a37

View file

@ -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];
}