Change action handler
This commit is contained in:
parent
7fb9aad0d0
commit
28c12861e5
@ -104,14 +104,36 @@ class ActionHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('keydown', (event) => ths.handleKeydown(event) );
|
// events should be handled in handleEvent function. We need to do things this
|
||||||
document.addEventListener('keyup', (event) => ths.handleKeyup(event) );
|
// way, otherwise we can't remove event listenerđ
|
||||||
|
// https://stackoverflow.com/a/19507086
|
||||||
|
document.addEventListener('keydown', this );
|
||||||
|
document.addEventListener('keyup', this );
|
||||||
|
|
||||||
this.pageInfo.setActionHandler(this);
|
this.pageInfo.setActionHandler(this);
|
||||||
|
|
||||||
this.logger.log('info', 'debug', "[ActionHandler::init] initialization complete");
|
this.logger.log('info', 'debug', "[ActionHandler::init] initialization complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleEvent(event) {
|
||||||
|
switch(event.type) {
|
||||||
|
case 'keydown':
|
||||||
|
this.handleKeydown(event);
|
||||||
|
break;
|
||||||
|
case 'keyup':
|
||||||
|
this.handleKeyup(event);
|
||||||
|
break;
|
||||||
|
case 'mousemove':
|
||||||
|
this.handleMouseMove(event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
document.removeEventListener('keydown', this);
|
||||||
|
document.removeEventListener('keyup', this);
|
||||||
|
}
|
||||||
|
|
||||||
registerHandleMouse(videoData) {
|
registerHandleMouse(videoData) {
|
||||||
this.logger.log('info', ['actionHandler', 'mousemove'], "[ActionHandler::registerHandleMouse] registering handle mouse for videodata:", videoData.id)
|
this.logger.log('info', ['actionHandler', 'mousemove'], "[ActionHandler::registerHandleMouse] registering handle mouse for videodata:", videoData.id)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user