dmauro / Keypress

A keyboard input capturing utility in which any key can be a modifier key.
http://dmauro.github.io/Keypress/
Apache License 2.0
3.18k stars 313 forks source link

Using with Meteor [ TypeError: Keypress.Listener is not a constructor ] #145

Closed lesliechw closed 6 years ago

lesliechw commented 6 years ago

Meteor latest 1.7 version. keypress-2.1.5.min.js located at client/lib/keypress-2.1.5.min.js Tried import in every possible way, include 'require'.

I keep getting the following error:

TypeError: Keypress.Listener is not a constructor

I'm pretty sure it's import/include/require issue but can't find out why it doesn't work.

Please advice, thanks.

dmauro commented 6 years ago

Here's what it's trying to do re: exporting: https://github.com/dmauro/Keypress/blob/development/keypress.js#L1145-L1153 It could be it's not playing nice with newer ways of doing that. Maybe check if it's defined in window.keypress in your environment?

lesliechw commented 6 years ago

I put the file to /client/compatibility folder and it's working. But the "meteor" note you put up, the initialisation step, there is typo error. Keypress with capital K is wrong. It's small letter k keypress is correct.

Thanks.

On Tue, Sep 25, 2018 at 7:03 AM David Mauro notifications@github.com wrote:

Here's what it's trying to do re: exporting: https://github.com/dmauro/Keypress/blob/development/keypress.js#L1145-L1153 It could be it's not playing nice with newer ways of doing that. Maybe check if it's defined in window.keypress in your environment?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dmauro/Keypress/issues/145#issuecomment-424153733, or mute the thread https://github.com/notifications/unsubscribe-auth/AD3DCBbDbZ7P-YzvAqAObYLvxRxrfpX6ks5ueWSpgaJpZM4W1pd9 .

dmauro commented 6 years ago

Ah, thank you for catching that! I updated that meteor README, so sorry about that. Gonna mark this as closed since it looks like you're all set now.