没有新行的终端Javascript定时器
我正在使用终端,我想在每次更改文本时不换行 这是我的密码没有新行的终端Javascript定时器,javascript,Javascript,我正在使用终端,我想在每次更改文本时不换行 这是我的密码 var c = 0; var t; var timer_is_on = 0; function timedCount() { term.pause(); if (c == 100) { clearTimeout(t); } else { term.echo(c); c = c + 1; t = setTimeout(function(){ ti
var c = 0;
var t;
var timer_is_on = 0;
function timedCount() {
term.pause();
if (c == 100) {
clearTimeout(t);
}
else {
term.echo(c);
c = c + 1;
t = setTimeout(function(){ timedCount() }, 100);
t = setTimeout(function(){ timeClear() }, 900)
}
}
function timeClear(){
term.clear();
}
function startCount() {
if (!timer_is_on) {
timer_is_on = 1;
timedCount();
}
}
function stopCount() {
clearTimeout(t);
timer_is_on = 0;
}
timedCount();
我试着每秒钟添加一条没有新行的文字
示例:
Hello+1
,Hello 2
您可以创建一个fiddle jsiddle.net吗?在哪里定义了term
对象?而且,它并不是作为参数传递给实际要使用它的函数。