main: work in progress [might break]
This commit is contained in:
parent
c6ce294e69
commit
35ff5dc710
|
@ -151,6 +151,7 @@ if( typeof AFRAME != 'undefined '){
|
|||
animation:fade 1000ms infinite;
|
||||
-webkit-animation:fade 1000ms infinite;
|
||||
}
|
||||
|
||||
`
|
||||
},
|
||||
|
||||
|
|
|
@ -39,14 +39,16 @@ ISOTerminal.addEventListener('emulator-started', function(){
|
|||
})
|
||||
|
||||
window.addEventListener('error', function(event) {
|
||||
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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue