diff --git a/README.md b/README.md index 92f5694..42fa7c5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# WebXROS apps +# XRshell apps diff --git a/boot.js b/boot.js deleted file mode 100644 index 3a2a2ad..0000000 --- a/boot.js +++ /dev/null @@ -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") - - }, - -}); diff --git a/helloworld.js b/helloworld.js index af2941a..db7c658 100644 --- a/helloworld.js +++ b/helloworld.js @@ -3,8 +3,10 @@ AFRAME.registerComponent('helloworld', { init: function () { - // entrypoint for single-file xrshell/AFRAME components - this.addEventListener('xrshell', (opts) => { + let obj = this.object3D + + // entrypoint for single-file xrshell/THREE/AFRAME components + obj.addEventListener('xrshell', (opts) => { this.require = AFRAME.components.xrshell.require // available by adding this.require({ @@ -20,7 +22,7 @@ AFRAME.registerComponent('helloworld', { // 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.write('hello to XR linux terminal from AFRAME') term.on('stdout', (data) => { @@ -29,7 +31,7 @@ AFRAME.registerComponent('helloworld', { }) }) - this.addEventListener('context-menu', (menu) => { + obj.addEventListener('context-menu', (menu) => { menu.add({ name: 'edit', // "everything must have an edit-button" ~ Fabien Benetou 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}}) } } }) - }) console.log("hello world!") diff --git a/xrshell.js b/xrshell.js new file mode 100644 index 0000000..90ea98e --- /dev/null +++ b/xrshell.js @@ -0,0 +1,8 @@ +AFRAME.registerComponent('xrshell', { + init: function ( ) { + + console.log("this is the boot component which initializes other components") + + }, + +});