mousetrap
mousetrap copied to clipboard
Record plugin: "Uncaught ReferenceError: i is not defined"
I am trying to use the 'mousetrap-record' plugin. I've added all required scripts to my page, and then used the code from documentation:
Mousetrap.record(function(sequence) {
// sequence is an array like ['ctrl+k', 'c']
alert('You pressed: ' + sequence.join(' '));
});
In runtime, when I trigger the recording and hit any button, it throws this error:
As I can see, the origin of an error is this method:
Obviously, on line 73
i
variable is used, but it wasn't defined before.
Simple defining this variable solves the problem - like this:
May I create a pull request for this?
For everyone interested: I've fixed this issue, as well as #324 in my fork of this lib - https://github.com/DmitryShashkov/mousetrap I have also published it as an NPM module: https://www.npmjs.com/package/tn-mousetrap
I believe this is temporary, cause I hope solutions for both issues will be merged into original repository. But meanwhile, it may come in handy for someone.