update documentation

This commit is contained in:
Leon van Kammen 2023-11-03 11:55:51 +01:00
parent 274194a55c
commit 43ebcbb5e1
4 changed files with 15 additions and 25 deletions

View File

@ -1,4 +1,4 @@
# WebXROS apps # XRshell apps
<img src='https://github.com/coderofsalvation/xrshell/raw/main/src/assets/logo.svg' width="25%"/> <img src='https://github.com/coderofsalvation/xrshell/raw/main/src/assets/logo.svg' width="25%"/>

19
boot.js
View File

@ -1,19 +0,0 @@
AFRAME.registerComponent('boot', {
init: function ( ) {
let scene = document.querySelector('a-scene').object3D
// webxros events are optional, but can be listed here
scene.addEventListener('tty', (tty) => {
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.)
})
})
console.log("this is the boot component which initializes other components")
},
});

View File

@ -3,8 +3,10 @@ AFRAME.registerComponent('helloworld', {
init: function () { init: function () {
// entrypoint for single-file xrshell/AFRAME components let obj = this.object3D
this.addEventListener('xrshell', (opts) => {
// entrypoint for single-file xrshell/THREE/AFRAME components
obj.addEventListener('xrshell', (opts) => {
this.require = AFRAME.components.xrshell.require // available by adding <a-scene xrshell> this.require = AFRAME.components.xrshell.require // available by adding <a-scene xrshell>
this.require({ this.require({
@ -20,7 +22,7 @@ AFRAME.registerComponent('helloworld', {
// errors will show up in the javascript browser and XR terminal consoles. // errors will show up in the javascript browser and XR terminal consoles.
}) })
this.addEventListener('ISOterminal', (term) => { // act when component gets mounted obj.addEventListener('ISOterminal', (term) => { // act when component gets mounted
// 'term' is basically AFRAME.components.ISOterminal // 'term' is basically AFRAME.components.ISOterminal
term.write('hello to XR linux terminal from AFRAME') term.write('hello to XR linux terminal from AFRAME')
term.on('stdout', (data) => { term.on('stdout', (data) => {
@ -29,7 +31,7 @@ AFRAME.registerComponent('helloworld', {
}) })
}) })
this.addEventListener('context-menu', (menu) => { obj.addEventListener('context-menu', (menu) => {
menu.add({ menu.add({
name: 'edit', // "everything must have an edit-button" ~ Fabien Benetou name: 'edit', // "everything must have an edit-button" ~ Fabien Benetou
icon: 'gear', // see https://jsonforms.io to see json-2-html forms icon: 'gear', // see https://jsonforms.io to see json-2-html forms
@ -40,7 +42,6 @@ AFRAME.registerComponent('helloworld', {
edit_spatial: { type: 'function', cb: () => this.require({"spatial-edit":{required:true}}) } edit_spatial: { type: 'function', cb: () => this.require({"spatial-edit":{required:true}}) }
} }
}) })
}) })
console.log("hello world!") console.log("hello world!")

8
xrshell.js Normal file
View File

@ -0,0 +1,8 @@
AFRAME.registerComponent('xrshell', {
init: function ( ) {
console.log("this is the boot component which initializes other components")
},
});