Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
});
}
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;
});
}
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));
}
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));
}
componentDidMount() {
Mousetrap.bind('space', this.hide);
Mousetrap.bind('left', this.backward);
Mousetrap.bind('right', this.forward);
}
componentWillUnmount() {
componentDidMount() {
Mousetrap.bind('space', this.hide);
Mousetrap.bind('left', this.backward);
Mousetrap.bind('right', this.forward);
}
componentWillUnmount() {
componentDidMount() {
Mousetrap.bind('space', this.hide);
Mousetrap.bind('left', this.backward);
Mousetrap.bind('right', this.forward);
}
componentWillUnmount() {
on(key, action) {
this.keyStack = this.keyStack.updateIn([-1], keys => keys.push({key, action}));
Mousetrap.bind(key, action);
}
export function bindKey(
keys: string | string[],
callback: KeyboardCallback,
action?: KeyboardAction,
) {
Mousetrap.bind(keys, callback, action)
}
public on(keys: string, callback: (e: KeyboardEvent, combo: string) => void) {
return Mousetrap.bind(keys, (event: any, combo: any) => {
return callback(event, combo);
});
}