keithamus / jwerty

⌨ Awesome handling of keyboard events
http://keithamus.github.io/jwerty
Other
1.21k stars 109 forks source link

Browserify + node-webkit compatiblity #48

Closed LoicMahieu closed 10 years ago

LoicMahieu commented 10 years ago

In browserify environment, jQuery/Zepto/Ender is not available in the context of the module. It need to be required. In node-webkit environment, the context (or global in the closure) is an empty object. To get the expected window object, global.window is provided.

keithamus commented 10 years ago

While I like the idea of the PR, and this definitely needs to be solved, I'm not sure I like the way of doing it... explicitly requiring jQuery actually prevents a key feature of jwerty. Perhaps a way to fix this is to add a jwerty method to override jwerty's $ reference with your own chosing? Or just expose jwerty.$ et al to be overridden.

Feel free to change this PR, or close it and make a new one. I'll definitely merge the right solution (but this isn't it).

LoicMahieu commented 10 years ago

You're completely right about jQuery dependency. I updated my PR to remove them. Try/Catch around require() is a little hacky but I have not find any better solution. (Used in node-redis)

keithamus commented 10 years ago

I'd say nail the two mentioned issues, and I'll be happy to merge

LoicMahieu commented 10 years ago

I updated my PR

keithamus commented 10 years ago

Great work. Sorry I took so damn long to merge this :+1: