|
@ -47,6 +47,7 @@ export class TimeTrackerApp extends DtpApp { |
|
|
/* |
|
|
/* |
|
|
* Page Visibility API hooks |
|
|
* Page Visibility API hooks |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
window.addEventListener('pageshow', this.onWindowPageShow.bind(this)); |
|
|
window.addEventListener('pagehide', this.onWindowPageHide.bind(this)); |
|
|
window.addEventListener('pagehide', this.onWindowPageHide.bind(this)); |
|
|
window.addEventListener('freeze', this.onWindowFreeze.bind(this)); |
|
|
window.addEventListener('freeze', this.onWindowFreeze.bind(this)); |
|
|
window.addEventListener('resume', this.onWindowResume.bind(this)); |
|
|
window.addEventListener('resume', this.onWindowResume.bind(this)); |
|
@ -74,10 +75,16 @@ export class TimeTrackerApp extends DtpApp { |
|
|
this.haveFocus = false; |
|
|
this.haveFocus = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async onWindowPageShow (event) { |
|
|
|
|
|
this.log.debug('onWindowPageShow', 'the page is being shown', { event }); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
async onWindowPageHide (event) { |
|
|
async onWindowPageHide (event) { |
|
|
this.log.debug('onWindowPageHide', 'the page is being hidden', { event }); |
|
|
this.log.debug('onWindowPageHide', 'the page is being hidden', { event }); |
|
|
|
|
|
if (!event.persisted) { |
|
|
await this.socket.disconnect(); |
|
|
await this.socket.disconnect(); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
async onWindowFreeze (event) { |
|
|
async onWindowFreeze (event) { |
|
|
this.log.debug('onWindowFreeze', 'the page is being frozen', { event }); |
|
|
this.log.debug('onWindowFreeze', 'the page is being frozen', { event }); |
|
|