@rxdi/hotkeys
TypeScript icon, indicating that this package has built-in type declarations

0.7.178 • Public • Published

@rxdi/hotkeys

Installation

npm i @rxdi/hotkeys
import { Module } from "@rxdi/core";
import { HotkeyModule } from "@rxdi/hotkeys";

@Module({
  imports: [
    HotkeyModule.forRoot({
      globalBindings: [
        [
          "ctrl+a",
          (e) => {
            console.log(e, "It works");
          },
        ],
      ],
    }),
  ],
})
export class AppModule {}
import { Injectable } from '@rxdi/core';
import { HotKeysService } from '@rxdi/hotkeys';

@Injectable()
export class HotkeysProvider {

 @Inject(HotKeysService)
 private hotkeys: HotKeysService;

 OnInit() {
   /* Binding from event */
  const sub = this.hotkeys.bind('ctrl+a').subscribe((stream) => {
   console.log('It works', stream);
  });

  /* Unbinding from event */
  sub.unsubscribe()
}

Readme

Keywords

none

Package Sidebar

Install

npm i @rxdi/hotkeys

Weekly Downloads

70

Version

0.7.178

License

MIT

Unpacked Size

7.19 kB

Total Files

10

Last publish

Collaborators

  • rxdi