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>
|
// work in progress
|
||||||
const updateComponents = AFRAME.AEntity.prototype.updateComponents
|
//
|
||||||
AFRAME.AEntity.prototype.updateComponents = function(updateComponents){
|
// //<script src="https://coderofsalvation.github.io/xrsh-apps/helloworld.js"></script>
|
||||||
return function(){
|
//const updateComponents = AFRAME.AEntity.prototype.updateComponents
|
||||||
return updateComponents.apply(this,args)
|
//AFRAME.AEntity.prototype.updateComponents = function(updateComponents){
|
||||||
}
|
// return function(){
|
||||||
}(updateComponents)
|
// return updateComponents.apply(this,args)
|
||||||
|
// }
|
||||||
|
//}(updateComponents)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
AFRAME.registerComponent('xrshell', {
|
AFRAME.registerComponent('xrsh', {
|
||||||
init: function ( ) {
|
init: function ( ) {
|
||||||
|
|
||||||
console.log("this is the boot component which initializes other components")
|
console.log("this is the boot component which initializes other components")
|
||||||
|
|
Loading…
Reference in New Issue