work in progress [might break]
This commit is contained in:
parent
1539df1fef
commit
513127a92b
|
@ -0,0 +1,30 @@
|
|||
AFRAME.registerComponent('helloworld', {
|
||||
schema:{
|
||||
things: {type:'array'},
|
||||
$: {default: document.createElement('div') }
|
||||
},
|
||||
init: function() {
|
||||
|
||||
this.data = new Proxy( this.data, {
|
||||
html(data){
|
||||
return `
|
||||
<style> ul{ position:absolute; top:0; left:0; z-index:0 } </style>
|
||||
<ul> ${this.render(data)} </ul>
|
||||
`
|
||||
},
|
||||
render(data ){ return `<li>${data.things.join("</li><li>")}</li>`},
|
||||
set(data,k,v){ (data[k] = v) && (data.$.innerHTML = this.html(data)) },
|
||||
get(data,k ){ return data[k] != undefined ? data[k] : data }
|
||||
})
|
||||
|
||||
document.body.appendChild(this.data.$)
|
||||
|
||||
setInterval( () => {
|
||||
// update js --> HTML+AFRAME
|
||||
this.data.things = [ ...this.data.things, Math.random() ].slice(-3)
|
||||
|
||||
},500)
|
||||
|
||||
},
|
||||
|
||||
})
|
|
@ -3,10 +3,12 @@ AFRAME.registerComponent('require', {
|
|||
},
|
||||
|
||||
})
|
||||
//<script src="https://coderofsalvation.github.io/xrsh-apps/helloworld.js"></script>
|
||||
const updateComponents = AFRAME.AEntity.prototype.updateComponents
|
||||
AFRAME.AEntity.prototype.updateComponents = function(updateComponents){
|
||||
return function(){
|
||||
return updateComponents.apply(this,args)
|
||||
}
|
||||
}(updateComponents)
|
||||
// work in progress
|
||||
//
|
||||
// //<script src="https://coderofsalvation.github.io/xrsh-apps/helloworld.js"></script>
|
||||
//const updateComponents = AFRAME.AEntity.prototype.updateComponents
|
||||
//AFRAME.AEntity.prototype.updateComponents = function(updateComponents){
|
||||
// return function(){
|
||||
// return updateComponents.apply(this,args)
|
||||
// }
|
||||
//}(updateComponents)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
AFRAME.registerComponent('xrshell', {
|
||||
AFRAME.registerComponent('xrsh', {
|
||||
init: function ( ) {
|
||||
|
||||
console.log("this is the boot component which initializes other components")
|
||||
|
|
Loading…
Reference in New Issue