fusescript wip
/ test (push) Successful in 5s
Details
/ test (push) Successful in 5s
Details
This commit is contained in:
parent
8b58f65c84
commit
bf8ee0f303
|
@ -290,6 +290,27 @@ ISOTerminal.prototype.bufferOutput = function(byte,cb,latency){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//ISOTerminal.prototype.bufferOutput = function(byte, cb, latency, buffer) {
|
||||
// const str = String.fromCharCode(byte);
|
||||
// //if (str === '\r' || str === '\n' || str.charCodeAt(0) < 32 || str.charCodeAt(0) === 127) {
|
||||
// // cb(str);
|
||||
// //} else if (str === '\x1b') { // ESC
|
||||
// // buffer.esc = true;
|
||||
// //} else if (buffer.esc) {
|
||||
// // cb('\x1b' + str);
|
||||
// // buffer.esc = false;
|
||||
// //} else {
|
||||
// buffer.str = (buffer.str || '') + str;
|
||||
// if (Date.now() - (buffer.timestamp || 0) >= latency) {
|
||||
// console.log(buffer.str)
|
||||
// cb(buffer.str);
|
||||
// buffer.str = '';
|
||||
// buffer.timestamp = Date.now();
|
||||
// }
|
||||
// //}
|
||||
//}
|
||||
|
||||
ISOTerminal.prototype.preventFrameDrop = function(cb){
|
||||
// don't let workers cause framerate dropping
|
||||
const xr = this.instance.sceneEl.renderer.xr
|
||||
|
|
|
@ -22,17 +22,25 @@ if( typeof emulator != 'undefined' ){
|
|||
|
||||
ISOTerminal.addEventListener('javascript-eval', async function(e){
|
||||
const {script,PID} = e.detail
|
||||
let res
|
||||
let res;
|
||||
|
||||
try{
|
||||
res = (new Function(`${script}`))()
|
||||
let f = new Function(`${script}`);
|
||||
res = f();
|
||||
if( res && typeof res != 'string' ) res = JSON.stringify(res,null,2)
|
||||
}catch(e){
|
||||
console.error(e)
|
||||
console.info(script)
|
||||
res = "error: "+e.toString()
|
||||
if( e.filename ){
|
||||
res += "\n"+e.filename+":"+e.lineno+":"+e.colno
|
||||
}
|
||||
}catch(err){
|
||||
console.error(err)
|
||||
console.dir(err)
|
||||
res = "error: "+err.toString()
|
||||
|
||||
// try to figure out line *FIXME*
|
||||
let line = err.stack.split("\n").find(e => e.includes("<anonymous>:") || e.includes("Function:"));
|
||||
if( line ){
|
||||
let lineIndex = (line.includes("<anonymous>:") && line.indexOf("<anonymous>:") + "<anonymous>:".length) || (line.includes("Function:") && line.indexOf("Function:") + "Function:".length);
|
||||
let lnr = +line.substring(lineIndex, lineIndex + 1) - 2
|
||||
res += script.split("\n")[lnr-1]
|
||||
}else console.dir(script)
|
||||
console.error(res)
|
||||
}
|
||||
// update output to 9p with PID as filename (in /mnt/run)
|
||||
if( PID ){
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -12,26 +12,29 @@ this.runISO = function(opts){
|
|||
console.log("[worker.js] started emulator")
|
||||
|
||||
// event forwarding
|
||||
emulator.buf0 = {}
|
||||
emulator.buf1 = {}
|
||||
emulator.buf2 = {}
|
||||
|
||||
emulator.add_listener("serial0-output-byte", function(byte){
|
||||
ISOTerminal.prototype.bufferOutput(byte, (str) => { // we buffer to prevent framerate dropping
|
||||
if( !str ) return
|
||||
this.postMessage({event:"serial0-output-string",data:str});
|
||||
}, opts.bufferLatency )
|
||||
}, opts.bufferLatency, emulator.buf0 )
|
||||
}.bind(this));
|
||||
|
||||
emulator.add_listener("serial1-output-byte", function(byte){
|
||||
ISOTerminal.prototype.bufferOutput(byte, (str) => { // we buffer to prevent framerate dropping
|
||||
if( !str ) return
|
||||
this.postMessage({event:"serial1-output-string",data:str});
|
||||
}, opts.bufferLatency )
|
||||
}, opts.bufferLatency, emulator.buf1 )
|
||||
}.bind(this));
|
||||
|
||||
emulator.add_listener("serial2-output-byte", function(byte){
|
||||
ISOTerminal.prototype.bufferOutput(byte, (str) => { // we buffer to prevent framerate dropping
|
||||
if( !str ) return
|
||||
this.postMessage({event:"serial2-output-string",data:str});
|
||||
}, opts.bufferLatency )
|
||||
}, opts.bufferLatency, emulator.buf2 )
|
||||
}.bind(this));
|
||||
|
||||
emulator.add_listener("emulator-started", function(){
|
||||
|
|
Loading…
Reference in New Issue