37 lines
1 KiB
JavaScript
37 lines
1 KiB
JavaScript
|
|
if( typeof emulator != 'undefined' ){
|
||
|
|
// inside worker-thread
|
||
|
|
|
||
|
|
}else{
|
||
|
|
// inside browser-thread
|
||
|
|
//
|
||
|
|
ISOTerminal.prototype.remoteStorageInit = async function(opts){
|
||
|
|
await AFRAME.utils.require({"remoteStorageWidget": "com/lib/aframe-remotestorage.min.js"})
|
||
|
|
let el = document.querySelector("[remotestorage]")
|
||
|
|
if( el ){
|
||
|
|
let value = el.getAttribute("remotestorage")
|
||
|
|
el.removeAttribute("remotestorage")
|
||
|
|
el.setAttribute("remotestorage", value) // (re)activate aframe component
|
||
|
|
this.remoteStorageMount()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
ISOTerminal.prototype.remoteStorageGet = function(){
|
||
|
|
return document.querySelector('[remotestorage]')?.components.remotestorage.remoteStorage
|
||
|
|
}
|
||
|
|
|
||
|
|
ISOTerminal.prototype.remoteStorageMount = function(){
|
||
|
|
const rs = this.remoteStorageGet()
|
||
|
|
rs.addEventListener('connected', function(){
|
||
|
|
|
||
|
|
})
|
||
|
|
|
||
|
|
rs.addEventListener('not-connected', function(){
|
||
|
|
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
ISOTerminal.addEventListener('init', function(){
|
||
|
|
this.addEventListener('term_init', (opts) => this.remoteStorageInit(opts.detail) )
|
||
|
|
})
|
||
|
|
}
|