package
Decorator for keybinding
npm install keybinding-decoratorGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 2 packages.
199.5 kB
Includes dependencies.
keybinding-decorator is using Mousetrap.
Decorators offer a convenient declarative syntax to modify the shape of class declarations.
see: https://tc39.github.io/proposal-decorators/
You must use babel-plugin-transform-decorators-legacy.
$ npm install keybinding-decorator --saveimport React from 'react';
import ReactDOM from 'react-dom';
import keybind from 'keybinding-decorator';
class Main extends React.Component {
constructor() {
super();
this.state = { current: '' };
// init
Reflect.apply(this.csk, this, []);
Reflect.apply(this.esc, this, []);
}
@keybind('command+shift+k')
csk() {
A method binded by decorator has unbind method.
Release this function from Mousetrap.