keymaster icon indicating copy to clipboard operation
keymaster copied to clipboard

Allows shortcuts to be assigned to more than one scope

Open stevenleeg opened this issue 14 years ago • 4 comments

Allows a handler to be assigned to multiple scopes like so:

key('c', 'hello, world', callback_function)

stevenleeg avatar Sep 09 '11 02:09 stevenleeg

Fixed! Multiple scopes can now only be separated by commas.

stevenleeg avatar Sep 10 '11 01:09 stevenleeg

Hey! This code is leaking globals. Also, before I can accept it, it needs to have tests written (I still need to get around to write basic scope tests). Additionally, the README should be updated.

madrobby avatar Sep 12 '11 11:09 madrobby

I believe I fixed everything with the exception of the unit tests. For some reason I can't for the life of me figure out why mine is failing. I committed it anyway, so feel free to take a look at it and see if you can find anything wrong with it.

stevenleeg avatar Sep 12 '11 19:09 stevenleeg

I may be wrong, but I think this fix doesnt do what you're expecting - which is why your test is failing.

What you appear to have written is code to allow multiple scopes to executed at once i.e.

key('a','awesomecope1', function(){}); key('b','awesomecope2', function(){});

key.setScope('awesome1, awesome2');

I've add this as a test and it works fine so I will push this to your repo for you

listentorick avatar Nov 18 '11 10:11 listentorick