diff --git a/com/isoterminal/ISOTerminal.js b/com/isoterminal/ISOTerminal.js index c6d82db..aba4483 100644 --- a/com/isoterminal/ISOTerminal.js +++ b/com/isoterminal/ISOTerminal.js @@ -150,6 +150,8 @@ ISOTerminal.prototype.start = function(opts){ ISOTerminal.prototype.setupWorker = function(opts){ + if( typeof window.PromiseWorker == 'undefined' ) return this + /* * the WebWorker (which runs v86) * diff --git a/com/isoterminal/feat/boot.js b/com/isoterminal/feat/boot.js index 9cd5cc0..e2d3277 100644 --- a/com/isoterminal/feat/boot.js +++ b/com/isoterminal/feat/boot.js @@ -40,19 +40,21 @@ ISOTerminal.prototype.boot = async function(e){ ISOTerminal.prototype.boot.menu = [] // REPL: iso -ISOTerminal.prototype.boot.menu.push( - { - key: "1", - title: (opts) => `boot [31m${String(opts.iso || "").replace(/.*\//,'')}[0m Linux ❤️ `, - init: function(){ this.bootISO() }, - keyHandler: function(ch){ this.send(ch) } // send to v86 webworker - } -) +if( typeof window.PromiseWorker != 'undefined' ){ // if xrsh v86 is able to run in in worker + ISOTerminal.prototype.boot.menu.push( + { + key: "1", + title: (opts) => `boot [31m${String(opts.iso || "").replace(/.*\//,'')}[0m Linux ❤️ `, + init: function(){ this.bootISO() }, + keyHandler: function(ch){ this.send(ch) } // send to v86 webworker + } + ) +} // REPL: jsconsole ISOTerminal.prototype.boot.menu.push( { - key: "2", + key: "j", title: (opts) => "just give me an javascript-console in WebXR instantly", init: function(){ this.prompt = "\r[36m>[0m " @@ -60,7 +62,7 @@ ISOTerminal.prototype.boot.menu.push( this.emit('status',"javascript console") this.console = "" setTimeout( () => { - if( this.boot.menu.selected ) this.emit('serial-output-string', this.prompt) + this.emit('serial-output-string', this.prompt) }, 100 ) }, keyHandler: function(ch){ @@ -72,7 +74,9 @@ ISOTerminal.prototype.boot.menu.push( this.emit('serial-output-string', ch) const reset = () => { this.console = "" - setTimeout( () => "\n\r"+this.emit('serial-output-string', this.prompt),100) + setTimeout( () => { + if( this.boot.menu.selected ) this.emit('serial-output-string', this.prompt) + },100) } if( (ch == "\n" || ch == "\r") ){ try{ diff --git a/com/isoterminal/feat/jsconsole.js b/com/isoterminal/feat/jsconsole.js index a4db1e6..97f1dcb 100644 --- a/com/isoterminal/feat/jsconsole.js +++ b/com/isoterminal/feat/jsconsole.js @@ -3,7 +3,7 @@ ISOTerminal.prototype.redirectConsole = function(handler){ const dir = console.dir; const err = console.error; const warn = console.warn; - const addLineFeeds = (str) => typeof str == 'string' ? str.replace(/\n/g,"\n\r") : str + const addLineFeeds = (str) => typeof str == 'string' ? str.replace(/\n/g,"\r\n") : str console.log = (...args)=>{ const textArg = args[0]; diff --git a/com/require.js b/com/require.js index f7c4bec..55d3281 100644 --- a/com/require.js +++ b/com/require.js @@ -16,7 +16,6 @@ AFRAME.utils.require = function(arr_or_obj,opts){ opts = opts || {} let i = 0 let deps = [] - AFRAME.required = AFRAME.required || {} let packagesArr = arr_or_obj.map ? arr_or_obj : Object.values(arr_or_obj) const parseURI = function(uri){ @@ -36,8 +35,8 @@ AFRAME.utils.require = function(arr_or_obj,opts){ } // prevent duplicate requests - if( AFRAME.required[id] ) return // already loaded before - AFRAME.required[id] = true + if( AFRAME.utils.require.required[id] ) return // already loaded before + AFRAME.utils.require.required[id] = true if( !document.body.querySelector(`script#${id}`) && !document.body.querySelector(`link#${id}`) ){ @@ -72,4 +71,6 @@ AFRAME.utils.require = function(arr_or_obj,opts){ return Promise.all(deps) } +AFRAME.utils.require.required = {} + AFRAME.utils.require.baseURL = './com/' diff --git a/com/window.js b/com/window.js index 6cb2ad6..b23d1f8 100644 --- a/com/window.js +++ b/com/window.js @@ -41,8 +41,7 @@ AFRAME.registerComponent('window', { dependencies:{ dom: "com/dom.js", - winboxjs: "https://unpkg.com/winbox@0.2.82/dist/winbox.bundle.min.js", // deadsimple windows: https://nextapps-de.github.io/winbox - //winboxcss: "https://unpkg.com/winbox@0.2.82/dist/css/winbox.min.css", // main theme + winboxjs: "../assets/winbox.bundle.min.js", // deadsimple windows: https://nextapps-de.github.io/winbox }, init: function(){