This commit is contained in:
parent
9d549454d6
commit
1ebb8b32ab
2 changed files with 452 additions and 0 deletions
36
com/isoterminal/feat/remoteStorage.js
Normal file
36
com/isoterminal/feat/remoteStorage.js
Normal 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
416
com/lib/aframe-remotestorage.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue