#!/bin/js // do once (remember /etc/profile gets sources multiple times!) if( !window['/etc/profile.js'] ){ const isoterminal = document.querySelector('[isoterminal]').components.isoterminal.term const scene = document.querySelector('a-scene') // map AFRAME events to ~/hook.d/{event}/* triggers events = ['enter-ar','enter-vr','exit-vr','exit-ar'] events.map( (event) => { scene.addEventListener( event, (e) => isoterminal.exec("hook "+event) ) }) window['/etc/profile.js'] = true }