How to use mousetrap - 10 common examples

To help you get started, we’ve selected a few mousetrap 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 oTranscribe / oTranscribe / src / js / app / ui.js View on Github external
export function addKeyboardShortcut(key, fn) {
    Mousetrap.unbind(key);
    Mousetrap.bind(key, function(e) {
        if (e.preventDefault) {
            e.preventDefault();
        } else {
            // internet explorer
            e.returnValue = false;
        }
        fn();
        return false;
    });
    
}
github oTranscribe / oTranscribe / src / js / app / ui.js View on Github external
export function addKeyboardShortcut(key, fn) {
    Mousetrap.unbind(key);
    Mousetrap.bind(key, function(e) {
        if (e.preventDefault) {
            e.preventDefault();
        } else {
            // internet explorer
            e.returnValue = false;
        }
        fn();
        return false;
    });
    
}
github phodal / inception / src / app / presentation / inception / inception-nav-bar / inception-nav-bar.component.ts View on Github external
ngAfterViewInit(): void {
    this.linksData.forEach((link, index) => {
      if (link.link === this.router.url) {
        this.currentRouterIndex = index;
      }
    });

    console.log(this.currentRouterIndex);

    Mousetrap.bind('left', this.moveRouterToLeft.bind(this));
    Mousetrap.bind('right', this.moveRouterToRight.bind(this));
  }
github phodal / inception / src / app / presentation / inception / inception-nav-bar / inception-nav-bar.component.ts View on Github external
ngAfterViewInit(): void {
    this.linksData.forEach((link, index) => {
      if (link.link === this.router.url) {
        this.currentRouterIndex = index;
      }
    });

    console.log(this.currentRouterIndex);

    Mousetrap.bind('left', this.moveRouterToLeft.bind(this));
    Mousetrap.bind('right', this.moveRouterToRight.bind(this));
  }
github jotron / StudyMD / src / components / oneset / index.js View on Github external
componentDidMount() {
        Mousetrap.bind('space', this.hide);
        Mousetrap.bind('left', this.backward);
        Mousetrap.bind('right', this.forward);
    }
    componentWillUnmount() {
github jotron / StudyMD / src / components / oneset / index.js View on Github external
componentDidMount() {
        Mousetrap.bind('space', this.hide);
        Mousetrap.bind('left', this.backward);
        Mousetrap.bind('right', this.forward);
    }
    componentWillUnmount() {
github jotron / StudyMD / src / components / oneset / index.js View on Github external
componentDidMount() {
        Mousetrap.bind('space', this.hide);
        Mousetrap.bind('left', this.backward);
        Mousetrap.bind('right', this.forward);
    }
    componentWillUnmount() {
github onefinestay / django-mediacat / static / js / keyboard.js View on Github external
on(key, action) {
    this.keyStack = this.keyStack.updateIn([-1], keys => keys.push({key, action}));
    Mousetrap.bind(key, action);
  }
github skellock / typescript-with-electron-react-kit / src / lib / keyboard / keyboard.ts View on Github external
export function bindKey(
  keys: string | string[],
  callback: KeyboardCallback,
  action?: KeyboardAction,
) {
  Mousetrap.bind(keys, callback, action)
}
github Squidex / squidex / src / Squidex / app / framework / services / shortcut.service.ts View on Github external
public on(keys: string, callback: (e: KeyboardEvent, combo: string) => void) {
        return Mousetrap.bind(keys, (event: any, combo: any) => {
            return callback(event, combo);
        });
    }

mousetrap

Simple library for handling keyboard shortcuts

Apache-2.0
Latest version published 5 years ago

Package Health Score

69 / 100
Full package analysis

Popular mousetrap functions