@next-level-integration/nli-hotkeys
v10.0.8-beta
Published
This lib provides features to add key board short cuts and then subscribe to the functionality. Or use common features readily available such as hotkeys for pagination.
Downloads
27
Maintainers
Keywords
Readme
Hot Keys Service
This lib provides features to add key board short cuts and then subscribe to the functionality. Or use common features readily available such as hotkeys for pagination.
How to use
1: Hotkeys service :
npm install @next-level-integration/nli-hotkeys --save
Just import the NliHotkeysModule and add HotkeysService in the providers.
a. Pass the keyboard buttons as params with their descriptions using the interface Options(refer hotkeys.service.ts)
Example of caller class:
method(){
this.hotkeys.addShortcut({
keys: 'control.c',
description: 'this button does something'
}).subscribe(function () {
return doSomething();
}));
}
b. Use the readily available pagination hotkeys feature. Example of the caller class:
ngOnInit() {
this.hotkeys.activatePaginationHotkeys();
}
@HostListener('window:keyup.ArrowRight', ['$event'])
@HostListener('window:keyup.ArrowLeft', ['$event'])
@HostListener('window:keyup.control.ArrowRight', ['$event'])
@HostListener('window:keyup.control.ArrowLeft', ['$event'])
changePage(event: KeyboardEvent) {
this.hotkeys.changePage(this.paginator, event.ctrlKey, event.key);
this.loadMessagePage()
}
- Show Hot keys component provides a shortcut using shift.f1 to see all the available hotkeys in the system.