mousetrap icon indicating copy to clipboard operation
mousetrap copied to clipboard

Record plugin: "Uncaught ReferenceError: i is not defined"

Open DmitryShashkov opened this issue 4 years ago • 1 comments

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: Error log

As I can see, the origin of an error is this method: Method with error Obviously, on line 73 i variable is used, but it wasn't defined before.

Simple defining this variable solves the problem - like this: Solution

May I create a pull request for this?

DmitryShashkov avatar Feb 15 '20 08:02 DmitryShashkov

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.

DmitryShashkov avatar Feb 20 '20 09:02 DmitryShashkov