CREATE A KEYBINDING SERVICE IN ANGULAR
To run this project, clone it to your device, open the folder, and run npm install
.
Once the install is finished, run npm start
to serve the project.
How to use
Add the service to your constructor
constructor(private keybind: KeyBindService) {}
Create your key binding matcher
const metaKeyUpKey$ = this.keybind.match('UP_ARROW', ['altKey']);
Subscribe to the event to use it
const subscription = metaKeyUpKey$.subscribe(() => alert('keybinding hit'))
Unsubscribe to stop listening to the event
subscription.unsubscribe()