mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 09:24:51 +00:00
feature(console) add Buffer
This commit is contained in:
parent
638ac9f003
commit
a0a064e985
1 changed files with 21 additions and 6 deletions
|
|
@ -2,6 +2,11 @@ var CloudCmd, Util, DOM, $;
|
|||
(function(CloudCmd, Util, DOM){
|
||||
'use strict';
|
||||
|
||||
var Buffer = {
|
||||
log : '',
|
||||
error : ''
|
||||
};
|
||||
|
||||
CloudCmd.Console = new ConsoleProto(CloudCmd, Util, DOM);
|
||||
|
||||
function ConsoleProto(CloudCmd, Util, DOM){
|
||||
|
|
@ -106,16 +111,26 @@ var CloudCmd, Util, DOM, $;
|
|||
CloudCmd.View.hide();
|
||||
};
|
||||
|
||||
this.log = function(pText){
|
||||
if (jqconsole)
|
||||
jqconsole.Write(pText, 'log-msg');
|
||||
this.log = function(pText) {
|
||||
log(pText, 'log');
|
||||
};
|
||||
|
||||
this.error = function(pText){
|
||||
if (jqconsole)
|
||||
jqconsole.Write(pText, 'error-msg');
|
||||
this.error = function(pText) {
|
||||
log(pText, 'error');
|
||||
};
|
||||
|
||||
function log(msg, status) {
|
||||
var ret;
|
||||
|
||||
Buffer[status] += msg;
|
||||
ret = Util.isContainStr(Buffer[status], '\n');
|
||||
|
||||
if (jqconsole && ret) {
|
||||
jqconsole.Write(Buffer[status], status + '-msg');
|
||||
Buffer[status] = '';
|
||||
}
|
||||
}
|
||||
|
||||
function load(pCallBack){
|
||||
Util.time(Name + ' load');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue