xrsh-buildroot/buildroot-v86/board/v86/rootfs_overlay/etc/profile.js

18 lines
526 B
JavaScript

#!/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
}