Skip to content

Commit

Permalink
Updated README.MD with a blurb about how Hotkeys must have a descript…
Browse files Browse the repository at this point in the history
…ion to show up in the cheat sheet.

In reference to issue #63
  • Loading branch information
wittlock committed Feb 12, 2018
1 parent c895883 commit 707c294
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ Based off of the [angular-hotkeys library](https://github.com/chieffancypants/an
To enable the cheat sheet, simply add `<hotkeys-cheatsheet></hotkeys-cheatsheet>` to your top level component template.
The `HotkeysService` will automatically register the `?` key combo to toggle the cheat sheet.

**NB!** Only hotkeys that have a description will apear on the cheat sheet. The Hotkey constructor takes a description as
an optional fourth parameter as a string or optionally as a function for dynamic descriptions.

```typescript
this._hotkeysService.add(new Hotkey('meta+shift+g', (event: KeyboardEvent): boolean => {
console.log('Secret message');
return false;
}, undefined, 'Send a secret message to the console.'));
```

The third parameter, given as `undefined`, can be used to allow the Hotkey to fire in INPUT, SELECT or TEXTAREA tags.

### Cheat Sheet Customization

1. You can now pass in custom options in `HotkeysModule.forRoot(options: IHotkeyOptions)`.
Expand Down

0 comments on commit 707c294

Please sign in to comment.