main: work in progress [might break]
/ mirror_to_github (push) Successful in 18s Details
/ test (push) Successful in 5s Details

This commit is contained in:
Leon van Kammen 2024-09-25 13:58:40 +00:00
parent c6ce294e69
commit 35ff5dc710
3 changed files with 24 additions and 21 deletions

View File

@ -151,6 +151,7 @@ if( typeof AFRAME != 'undefined '){
animation:fade 1000ms infinite;
-webkit-animation:fade 1000ms infinite;
}
`
},

View File

@ -39,14 +39,16 @@ ISOTerminal.addEventListener('emulator-started', function(){
})
window.addEventListener('error', function(event) {
console.error(event.filename+":"+event.lineno+":"+event.colno)
console.error(event.message);
console.error(event.error);
if( event.filename ){
console.error(event.filename+":"+event.lineno+":"+event.colno)
console.error(event.message);
console.error(event.error);
}else console.error(event)
});
window.addEventListener('unhandledrejection', function(event) {
console.error('Unhandled promise rejection:')
console.error(event.reason);
console.error(event);
});
// enable/disable logging file (echo 1 > mnt/console.tty)

View File

@ -30,36 +30,36 @@ ISOTerminal.prototype.xtermInit = function(){
// xterm relies on requestAnimationFrame (which does not called in immersive mode)
let _window = term._core._coreBrowserService._window
if( !_window.requestAnimationFrameAFRAME ){ // patch the planet!
if( !_window._XRSH_proxied ){ // patch the planet!
// _window.requestAnimationFrameAFRAME = function(cb){
// if( term.tid != null ) clearTimeout(term.tid)
// term.tid = setTimeout( function(){
// console.log("render")
// cb()
// term.tid = null
// },100)
// }
_window.requestAnimationFrameAFRAME =
AFRAME.utils.throttleLeadingAndTrailing( function(cb){
cb()
},150 )
//_window.requestAnimationFrameAFRAME = function(cb){
// if( term.tid != null ) clearTimeout(term.tid)
// term.tid = setTimeout( function(){
// console.log("render")
// cb()
// term.tid = null
// },100)
//}
const requestAnimationFrameAFRAME = AFRAME.utils.throttleLeadingAndTrailing(
function(cb){ cb() },150
)
// we proxy the _window object of xterm, and reroute
// requestAnimationFrame to requestAnimationFrameAFRAME
_window = new Proxy(_window,{
_window_new = new Proxy(_window,{
get(me,k){
if( k == '_XRSH_proxied' ) return true
if( k == 'requestAnimationFrame' ){
return me.requestAnimationFrameAFRAME
return requestAnimationFrameAFRAME.bind(me)
}
return me[k]
return typeof me[k] == 'function' ? me[k].bind(me) : me[k]
},
set(me,k,v){
me[k] = v
return true
}
})
term._core._coreBrowserService._window = _window
term._core._coreBrowserService._window = _window_new
}
})