控制台在第 5 行和第 8 行显示错误。错误是“未捕获的插入函数参数不是字符串”。任何帮助将不胜感激。谢谢!
$(function() {
var animation = false;
function typed(term, message, delay, finish) {
animation = true;
var da = 0;
term.set_prompt('');
var interval = setInterval(function() {
term.insert(message[da++]);
if(da > message.length) {
clearInterval(interval);
setTimeout(function() {
term.set_command('')
term.set_prompt(message + ' ');
animation = false;
finish && finish();
}, delay);
}
}, delay);
}
$('#fyeah').terminal(function(cmd, term) {
var finish = false;
}, {
name: 'test',
greetings: null,
onInit: function(term) {
var msg = "testing";
typed(term, msg, 150, function() {
finish = true;
});
},
keydown: function(e) {
if (animation) {
return false;
}
}
});
});