feat/remotestorage
All checks were successful
/ test (push) Successful in 6s

This commit is contained in:
Leon van Kammen 2025-04-25 16:18:40 +02:00
parent 9d549454d6
commit 1ebb8b32ab
2 changed files with 452 additions and 0 deletions

View file

@ -0,0 +1,36 @@
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) )
})
}

416
com/lib/aframe-remotestorage.min.js vendored Normal file

File diff suppressed because one or more lines are too long