2023-11-01 12:53:18 +01:00
|
|
|
AFRAME.registerComponent('helloworld', {
|
|
|
|
schema: {
|
|
|
|
foo: {type: 'string', default: ''},
|
|
|
|
},
|
|
|
|
|
|
|
|
init: function ( ) {
|
|
|
|
|
|
|
|
let scene = document.querySelector('a-scene').object3D
|
|
|
|
|
|
|
|
// webxros events are optional, but can be listed here
|
2023-11-01 13:05:38 +01:00
|
|
|
scene.addEventListener('tty', (tty) => {
|
2023-11-01 12:53:18 +01:00
|
|
|
tty.write("hello terminal from XR")
|
|
|
|
tty.on('stdout', (data) => {
|
|
|
|
// react to data being spoken/typed into the terminal
|
|
|
|
// (spatial prompting like 'open foo.gltf', 'component helloworld' e.g.)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2023-11-01 12:58:37 +01:00
|
|
|
console.log("hello world!")
|
|
|
|
|
2023-11-01 12:53:18 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
});
|