Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizing window and document #131

Open
denis-sokolov opened this issue Jul 12, 2014 · 3 comments
Open

Customizing window and document #131

denis-sokolov opened this issue Jul 12, 2014 · 3 comments

Comments

@denis-sokolov
Copy link

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?

@moroshko
Copy link

Any update on this?

@madrobby
Copy link
Owner

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).

@denis-sokolov
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants