IcarusWorks / ember-key-manager

A service for (un)binding keyboard up and down events.
MIT License
42 stars 11 forks source link

Uncaught TypeError: Cannot read property 'toLowerCase' of null #44

Open gossi opened 6 years ago

gossi commented 6 years ago

I do get this error with v0.3.0, the mentioned line is:

https://github.com/IcarusWorks/ember-key-manager/blob/dc0db287261c49ef09d6077200a5fe6d7d48da8d/addon/services/key-manager.js#L161

gossi commented 6 years ago

I was looping over my user defined hotkeys:

macros.push(manager.addMacro({
    executionKey: node.get('hotkey'),
    keyEvent: 'keydown',
    callback: () => {
        // ...
    }
}));

Some nodes didn't had a hotkey and most likely had null registering, should be prevent by an error message, I guess?

jordpo commented 6 years ago

👍 on a warning message if no 'executionKey' is specified.

jordpo commented 6 years ago

@gossi do you want to take a stab at it and follow the same pattern that we did here? https://github.com/IcarusWorks/ember-key-manager/blob/master/addon/services/key-manager.js#L61