piranha / keymage

Yet Another JS Keybinding library
ISC License
332 stars 31 forks source link

Publish to NPM #6

Closed jeffchan closed 10 years ago

jeffchan commented 10 years ago

It would be great if keymage was published to NPM so Browserify can easily fetch the files.

piranha commented 10 years ago

Makes sense. I'll try to get to that soon.

piranha commented 10 years ago

Done! Please check if everything's ok for you. :)

StephanHoyer commented 10 years ago

Does not work, since you did not export anything. If you can't get this done, drop me a line, so I can assist

piranha commented 10 years ago

Hah, that's funny, sorry. Should be ok now.

StephanHoyer commented 10 years ago

Wow, that was fast... works like a charm :+1: Was in the process of switching to keymaster... but now I'm back.

piranha commented 10 years ago

Cool, thanks for feedback, and making me feel that my work is not useless! Hope it'll serve you well, but if anything - don't hesitate to open an issue. :) Or send a pull request FWIW. ;)

StephanHoyer commented 10 years ago

As far as I can say from currently having one key binding in my App, your module works great :dancers:

Keeping calm when called in node-env would be nice to have. Currently I have to shim this out in my isomorphic application

global.window = {
  addEventListener: function(){}
};
global.navigator = {
  userAgent: ''
};
piranha commented 10 years ago

I've made to ignore navigator, but then I'm really not sure what to do with window. Probably just ignoring it is fine... Maybe I should issue a warning or something?

piranha commented 10 years ago

I just wonder if that will make someone's life harder by not reporting this error properly.

StephanHoyer commented 10 years ago

maybe I handle this myself. But just in case you want to handle this too, this will do the trick:

if (typeof window !== 'undefined') {
  window.addEventListener('keydown', dispatch, false);
}
piranha commented 10 years ago

Yeah, that's understandable (I handled navigator this way), but it's just I'm worried it'll prevent someone from discovering what is the problem. So I think it's better for your app to just explicitly handle this problem, than for keymage to silently not work in an environment which is not suitable.

StephanHoyer commented 10 years ago

yeah sounds reasonable!