How to use the angular2-hotkeys.Hotkey function in angular2-hotkeys

To help you get started, we’ve selected a few angular2-hotkeys examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github exceptionless / Exceptionless.UI / src / app / components / layout / event / event.component.ts View on Github external
private addHotKeys() {
        if (this.event.stack_id) {
            this.hotkeysService.add(new Hotkey("mod+up", (event: KeyboardEvent): boolean => {
                $ExceptionlessClient.createFeatureUsage(`${this._source}.hotkeys.GoToStack`)
                    .addTags("hotkeys")
                    .setProperty("id", this.eventId)
                    .submit();
                this.router.navigate([`/type/event/${this.eventId}`]);
                return false;
            }));

            if (this.clipboardService.isSupported) {
                this.hotkeysService.add(new Hotkey("mod+shift+c", (event: KeyboardEvent): boolean => {
                    $ExceptionlessClient.createFeatureUsage(`${this._source}.hotkeys.CopyEventJSON`)
                        .addTags("hotkeys")
                        .setProperty("id", this.eventId)
                        .submit();
                    this.clipboardService.copyFromContent(this.eventJson);
                    return false;
                }));
            }
        }

        if (this.previous) {
            this.hotkeysService.add(new Hotkey("mod+left", (event: KeyboardEvent): boolean => {
                $ExceptionlessClient.createFeatureUsage(`${this._source}.hotkeys.PreviousOccurrence`)
                    .addTags("hotkeys")
                    .setProperty("id", this.eventId)
                    .submit();
github search-future / miyou.tv / miyoutv / src / app / programs / program-play.component.ts View on Github external
},
      [],
      '音量を下げる',
    ), new Hotkey(
      ['left', 'mod+left'],
      (): boolean => {
        if (document.elementFromPoint(0, 0).className !== 'cfp-hotkeys') {
          this.player.jumpBackward('11s');
          return false;
        }
        return true;
      },
      [],
      '10秒戻す',
    ), new Hotkey(
      ['right', 'mod+right'],
      (): boolean => {
        if (document.elementFromPoint(0, 0).className !== 'cfp-hotkeys') {
          this.player.jumpForward('29s');
          return false;
        }
        return true;
      },
      [],
      '30秒進める',
    ), new Hotkey(
      ['shift+left', '['],
      (): boolean => {
        if (document.elementFromPoint(0, 0).className !== 'cfp-hotkeys') {
          this.commentPlayer.delay -= 500;
          return false;
github Gisto / Gisto / src / app / app.component.ts View on Github external
constructor(private hotkeysService: HotkeysService, public uiStore: UiStore) {
    this.hotkeyShiftSpace = hotkeysService.add(
      new Hotkey('shift+space', this.hotkeyShiftSpacePressed, ['INPUT', 'TEXTAREA'], 'Super search')
    );
  }
github omenyayl / dataset-annotator / src / pages / items / items.ts View on Github external
updateHotkeys(hotkeys) {
        if(this.hotkeys !== undefined) {
            this.hotkeyService.add(new Hotkey(this.hotkeys.nextImage, (): boolean =>{ return false }));
            this.hotkeyService.add(new Hotkey(this.hotkeys.prevImage, (): boolean =>{ return false }));
        }

        this.hotkeys = hotkeys;
        this.hotkeyService.add(new Hotkey(this.hotkeys.nextImage,
            (): boolean => {
                this.nextItem();
                return false;
            }));
        this.hotkeyService.add(new Hotkey(this.hotkeys.prevImage,
            (): boolean => {
                this.previousItem();
                return false;
            }));
    }
}
github search-future / miyou.tv / miyoutv / src / app / programs / program-play.component.ts View on Github external
return true;
      },
      [],
      'コメントを早める',
    ), new Hotkey(
      ['shift+right', ']'],
      (): boolean => {
        if (document.elementFromPoint(0, 0).className !== 'cfp-hotkeys') {
          this.commentPlayer.delay += 500;
          return false;
        }
        return true;
      },
      [],
      'コメントを遅らせる',
    ), new Hotkey(
      ['o', 'mod+s'],
      (): boolean => {
        if (document.elementFromPoint(0, 0).className !== 'cfp-hotkeys') {
          this.sidebarCollapsed = !this.sidebarCollapsed;
          return false;
        }
        return true;
      },
      [],
      'サイドバーを表示/非表示',
    )]);
  }
github exceptionless / Exceptionless.UI / src / app / app.component.ts View on Github external
this.hotkeysService.add(new Hotkey("g a", (event: KeyboardEvent): boolean => {
            this.router.navigate(["/account/manage"], { queryParams: { tab: "general" } });
            return false;
        }, null, "Go To My Account"));

        this.hotkeysService.add(new Hotkey("g n", (event: KeyboardEvent): boolean => {
            this.router.navigate(["/account/manage"], { queryParams: { tab: "notifications" } });
            return false;
        }, null, "Go To Notifications"));

        this.hotkeysService.add(new Hotkey("g d", (event: KeyboardEvent): boolean => {
            this.router.navigate(["/dashboard"]);
            return false;
        }, null, "Go To Dashboard"));

        this.hotkeysService.add(new Hotkey("g o", (event: KeyboardEvent): boolean => {
            this.router.navigate(["/organization/list"]);
            return false;
        }, null, "Go To Organizations"));

        this.hotkeysService.add(new Hotkey("g p", (event: KeyboardEvent): boolean => {
            this.router.navigate(["/project/list"]);
            return false;
        }, null, "Go To Projects"));

        this.hotkeysService.add(new Hotkey("g g", (event: KeyboardEvent): boolean => {
            window.open("https://github.com/exceptionless/Exceptionless", "_blank");
            return false;
        }, null, "Go To GitHub project"));

        this.hotkeysService.add(new Hotkey("g s", (event: KeyboardEvent): boolean => {
            window.open("http://slack.exceptionless.com", "_blank");
github omenyayl / dataset-annotator / src / pages / item / item.ts View on Github external
this.hotkeyService.add(new Hotkey(this.hotkeys.line,
            (): boolean => {
                this.selectCanvasDirective(this.canvasDirectives.canvas_line);
                return false;
            }));
        this.hotkeyService.add(new Hotkey(this.hotkeys.rectangle,
            (): boolean => {
                this.selectCanvasDirective(this.canvasDirectives.canvas_rect);
                return false;
            }));
        this.hotkeyService.add(new Hotkey(this.hotkeys.polygon,
            (): boolean => {
                this.selectCanvasDirective(this.canvasDirectives.canvas_polygon);
                return false;
            }));
        this.hotkeyService.add(new Hotkey(this.hotkeys.polyline,
            (): boolean => {
                this.selectCanvasDirective(this.canvasDirectives.canvas_polyline);
                return false;
            }));
    }
github runbox / runbox7 / src / app / app.component.ts View on Github external
public progressService: ProgressService,
    private mdIconRegistry: MatIconRegistry,
    private http: HttpClient,
    private sanitizer: DomSanitizer,
    private renderer: Renderer2,
    private ngZone: NgZone,
    public logoutservice: LogoutService,
    public websocketsearchservice: WebSocketSearchService,
    private draftDeskService: DraftDeskService,
    public messagelistservice: MessageListService,
    changeDetectorRef: ChangeDetectorRef,
    public mobileQuery: MobileQueryService,
    private swPush: SwPush,
    private _hotkeysService: HotkeysService) {

      this._hotkeysService.add(new Hotkey(['j', 'k'],
          (event: KeyboardEvent, combo: string): ExtendedKeyboardEvent => {
              if (combo === 'k') {
                  this.canvastable.scrollUp();
                  combo = null;
              }
              if (combo === 'j') {
                  this.canvastable.scrollDown();
              }
              const e: ExtendedKeyboardEvent = event;
              e.returnValue = false;
              return e;
          }));

    this.mdIconRegistry.addSvgIcon('movetofolder',
      this.sanitizer.bypassSecurityTrustResourceUrl('assets/movetofolder.svg'));
github search-future / miyou.tv / miyoutv / src / app / programs / program-play.component.ts View on Github external
protected initHotkeys() {
    this.oldHotkeys = Object.assign([], this.hotkeysService.get());
    this.hotkeysService.add([new Hotkey(
      's',
      (): boolean => {
        if (document.elementFromPoint(0, 0).className !== 'cfp-hotkeys') {
          this.stop();
          return false;
        }
        return true;
      },
      [],
      '再生を終了',
    ), new Hotkey(
      'space',
      (): boolean => {
        if (document.elementFromPoint(0, 0).className !== 'cfp-hotkeys') {
          this.player.togglePause();
          return false;

angular2-hotkeys

Angular 16 and Ivy Compatible. Older versions might work but isn't officially tested.

MIT
Latest version published 1 year ago

Package Health Score

60 / 100
Full package analysis