refactor(menu) show

This commit is contained in:
coderaiser 2014-06-06 08:40:36 -04:00
parent d14730b4da
commit ec95aad451

View file

@ -21,11 +21,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
function init() {
Loading = true;
Util.exec.series([
DOM.loadMenu,
Menu.show
]);
Menu.show();
Events.addKey(listener);
}
@ -35,7 +31,29 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
MenuContextFile.hide();
};
this.show = function(x, y ) {
this.show = function(position) {
var x, y,
showFunc;
if (position) {
x = position.x;
y = position.y;
}
showFunc = Util.exec.with(show, x, y);
Util.exec.if(MenuIO, showFunc, function() {
DOM.loadMenu(function(error) {
if (error)
DOM.Dialog.alert(error);
else
showFunc();
});
});
};
function show(x, y) {
if (!x || !y) {
x = (position || Position).x;
y = (position || Position).y;
@ -71,7 +89,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
position = null;
});
}
};
}
function getOptions(notFile) {
var name, func, options;