added iso-agnostic single-file AFRAME lib
This commit is contained in:
parent
ef890c8c34
commit
6c7667cd80
com
|
@ -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)
|
||||
*
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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/'
|
||||
|
|
|
@ -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(){
|
||||
|
|
Loading…
Reference in New Issue