fix(console) check prompt before create

This commit is contained in:
coderaiser 2014-07-11 10:35:35 -04:00
parent 2c40a543a6
commit 0f7cc67325

View file

@ -167,6 +167,13 @@ var CloudCmd, Util, DOM, CloudFunc, $;
Util.time(Name + ' load');
}
function isPrompt() {
var state = jqconsole.GetState(),
is = state === 'prompt';
return is;
}
function addListeners(callback) {
var options = {
'connect' : function() {
@ -174,11 +181,11 @@ var CloudCmd, Util, DOM, CloudFunc, $;
},
'disconnect': function() {
var state = jqconsole.GetState();
var is = isPrompt();
error(Socket.DISCONNECTED);
if (state === 'prompt')
if (is)
jqconsole.AbortPrompt();
}
};
@ -191,6 +198,8 @@ var CloudCmd, Util, DOM, CloudFunc, $;
}
function onMessage(json) {
var is = isPrompt();
if (json) {
Util.log(json);
@ -201,7 +210,8 @@ var CloudCmd, Util, DOM, CloudFunc, $;
jqconsole.SetPromptLabel(json.path + '> ');
}
jqconsole.Prompt(true, handler);
if (!is)
jqconsole.Prompt(true, handler);
}
init();