「term」を外部関数に渡そうとしています。
$('#item').terminal(function(command, term) {
これを行うことができた唯一の方法は、関数に「term」を渡すことです。
myfucntion(term, 'hello world');
毎回パスせずにこれを行う方法はありますか?
編集:
$(function () {
$('#cmd').terminal(function (command, term) {
switch (command) {
case 'start':
cmdtxt(term, 'hello world');
break;
default:
term.echo('');
}
}, {
height: 200,
prompt: '@MQ: '
});
});
function cmdtxt(term, t) {
term.echo(t);
}