# epom-ng2-keyboard-service
##### Service for comfortable work with keyboard
### No Input props (@Input)
### No Output props (@Output)
### Service public methods
| Syntax      | Description |
| ----------- | ----------- |
| **listen**(keyNameOrKeyNames: Array<string> &#124; string): Observable | return `Observable`, that emits when `keyup` on `document` fired and target element type `not input` and `keyName` is what we are looking for|
### Supported keyNames :
```
escape, enter, arrowRight, arrowLeft, arrowUp, arrowDown, tab, shift, control, alt, meta, backspace, space, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, w, v, x, y, z, -, ="
```
### Usage examples:
#### Popup
```
this.keyboardService.listen('escape').subscribe( pressedKey => {
    if(this.modalShowed) {
        this.close();
    }
});
```
#### Pagination
```
this.keyboardService.listen(['arrowRight', 'arrowLeft']).subscribe(pressedKey => {
    this.changePage(pressedKey === 'arrowRight' ? 'next' : 'prev');
});
```
