Customizing window and document
Currently the library adds event handlers using global variables.
Would you be open to modifying or accepting a pull request to allow customizing the window by passing it in as an argument?
Any update on this?
Is key.noConflict not enough? What's the use case here and how would you imagine at this to work (any patch should be backwards-compatible with earlier versions of keymaster).
Sorry, I have missed the notification originally.
The use case is using various window objects, for example in jsdom environment during various testing.
The simplest API for that would be to prepend a window parameter as the first parameter:
key(window, 'a', function(){ alert('you pressed a!') });
key(window, 'ctrl+r', function(){ alert('stopped reload!'); return false });
key(window, '⌘+r, ctrl+r', function(){ });
If the parameter has not been passed, take it from the global context.