mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2025-01-04 00:31:35 +00:00
Fix for previous - don't call callback synchronously
This commit is contained in:
parent
555f8de2ae
commit
a23879b693
6
dos.js
6
dos.js
@ -587,15 +587,15 @@ function DOS(tty) {
|
|||||||
tty.writeString(prompt); // TODO: Correct? Newline?
|
tty.writeString(prompt); // TODO: Correct? Newline?
|
||||||
var tmp = clockbuf;
|
var tmp = clockbuf;
|
||||||
clockbuf = '';
|
clockbuf = '';
|
||||||
callback(tmp);
|
setTimeout(function() { callback(tmp); }, 0);
|
||||||
}
|
}
|
||||||
function clock_readChar(callback) {
|
function clock_readChar(callback) {
|
||||||
if (!clockbuf.length) {
|
if (!clockbuf.length) {
|
||||||
callback('\r');
|
setTimeout(function() { callback('\r'); }, 0);
|
||||||
} else {
|
} else {
|
||||||
var c = clockbuf.substring(0, 1);
|
var c = clockbuf.substring(0, 1);
|
||||||
clockbuf = clockbuf.slice(1);
|
clockbuf = clockbuf.slice(1);
|
||||||
callback(c);
|
setTimeout(function() { callback(c); }, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user