Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
690 B

/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { Injectable } from '@angular/core';
import * as Mousetrap from 'mousetrap';
export const ShortcutServiceFactory = () => {
return new ShortcutService();
};
@Injectable()
export class ShortcutService {
public on(keys: string, callback: (e: KeyboardEvent, combo: string) => void) {
return Mousetrap.bind(keys, (event: any, combo: any) => {
return callback(event, combo);
});
}
public off(keys: string) {
Mousetrap.unbind(keys);
}
public trigger(keys: string) {
Mousetrap.trigger(keys);
}
}