Skip to content

Commit

Permalink
fix(release): update to angular 17 and bump all dependencies to latest
Browse files Browse the repository at this point in the history
convert to standalone
remove the module
run the control flow migration
convert the playground to standalone app
  • Loading branch information
Pilpin committed Mar 7, 2024
1 parent 3d17db6 commit 234edd9
Show file tree
Hide file tree
Showing 16 changed files with 300 additions and 326 deletions.
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Web apps are getting closer and closer to be desktop-class applications. With th
## Compatibility with Angular Versions

| @ngneat/hotkeys | Angular |
| --------------- | ------- |
|-----------------|---------|
| 3.x.x | >=17.2 |
| 2.x.x | >=16 |
| 1.3.x | >=14 |
| 1.2.x | <=13 |
Expand All @@ -47,6 +48,7 @@ Web apps are getting closer and closer to be desktop-class applications. With th

## Usage

### Module
Add `HotkeysModule` in your `AppModule`:

```ts
Expand All @@ -58,6 +60,17 @@ import { HotkeysModule } from '@ngneat/hotkeys';
export class AppModule {}
```

### Standalone
Add `HotkeysService` in your `ApplicationConfig` providers:

```ts
import {HotkeysService} from "@ngneat/hotkeys";

bootstrapApplication(AppComponent, {
providers: [HotkeysService]
})
```

Now you have two ways to start adding shortcuts to your application:

## Hotkeys Directive
Expand Down Expand Up @@ -137,7 +150,7 @@ interface Options {
}
```

#### `onShortcut`
### `onShortcut`

Listen to any registered hotkey. For example:

Expand All @@ -148,7 +161,7 @@ const unsubscribe = this.hotkeys.onShortcut((event, key, target) => console.log(
unsubscribe();
```

#### `registerHelpModal`
### `registerHelpModal`

Display a help dialog listing all visible hotkeys:

Expand All @@ -175,14 +188,15 @@ export class AppComponent implements AfterViewInit {
```

It accepts a second input that allows defining the hotkey that should open the dialog. The default shortcut is `Shift + ?`. Here's how `HotkeysHelpComponent` looks like:

```
<p align="center">
<img width="50%" height="50%" src="./help_screenshot.png">
</p>
```

You can also provide a custom component. To help you with that, the service exposes the `getShortcuts` method.

#### `removeShortcuts`
### `removeShortcuts`

Remove previously registered shortcuts.

Expand All @@ -193,7 +207,7 @@ this.hotkeys.removeShortcuts('meta.a');
this.hotkeys.removeShortcuts(['meta.1', 'meta.2']);
```

#### `setSequenceDebounce`
### `setSequenceDebounce`

Set the number of milliseconds to debounce a sequence of keys

Expand Down
3 changes: 3 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,8 @@
}
}
}
},
"cli": {
"analytics": false
}
}
Loading

0 comments on commit 234edd9

Please sign in to comment.