mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
fix(console) check prompt before create
This commit is contained in:
parent
2c40a543a6
commit
0f7cc67325
1 changed files with 13 additions and 3 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue