I'm getting error saying Uncaught TypeError: Cannot read properties of undefined (reading 'fireCustomEvent'). Please help how to resolve this as I'm making use of Oracle JET to write this javascript code
define([], () => {
'use strict';
//var eventHelper;
var idleTime = 0;
class PageModule {
constructor(context) {
this.eventHelper = context.getEventHelper();
// Increment the idle time counter every minute.
this.idleInterval = setInterval(this.timerIncrement, 5000); // 10 second
}
timerIncrement() {
console.log(idleTime);
idleTime = idleTime + 1;
if (idleTime > 0) {
console.log(this.eventHelper);
this.eventHelper.fireCustomEvent('openDialog', {});
}
}
}
// Zero the idle timer on mouse movement.
$(this).mousemove(function (e) { idleTime = 0; });
$(this).keypress(function (e) { idleTime = 0; });
return PageModule;
});