Closed artfuldev closed 8 years ago
I have used the keyCodes => displayKey converter from https://github.com/wesbos/keycodes and displayChar for keypress events I get using the method mentioned at http://javascript.info/tutorial/keyboard-events.
The javascript.info page I mentioned above also helped me provide the capsLock$ in the driver.
Little things like this are what I think we can provide with the driver as additional.
We can instead make use of the keycodes npm package that @raquelxmoss has used in cycle-keys.
The idea is to also provide an easy and hassle-free migration from cycle-keys, while keeping in mind the strengths and merits of the API we will be taking up.
@raquelxmoss @Widdershin can we get some things done? :)
I've been mulling it over and I think I still favor the method -> stream style over the new filter style.
The most common usecase by far will be an immediate filter. If we look at the the two most popular drivers for Cycle, it's clear there's a precedent for methods to events.
DOM.select('.foo').events('.click').elements()
HTTP.select('github').flatten()
Both of these could be written with filters + maps, and yet I think the intent is more clear by having prebuilt methods in place.
Plus with the method style API users can still get a stream of any event by calling the method with no arguments.
We can still attach the displayKey
property to the event so users can work with it in the stream itself.
I agree with @Widdershin, his suggestion might be a happy medium between the two approaches.
Ok, and in accordance with @raquelxmoss 's idea, we can also provide a keycode way for keyup and keydown... Let me start work on this.
Following this up in #27 Also see #28
From our gitter conversation:
Sudarsan Balaji @artfuldev 14:53
Nick Johnstone @Widdershin 14:54
Sudarsan Balaji @artfuldev 14:54
Nick Johnstone @Widdershin 14:54
Sudarsan Balaji @artfuldev 14:56
Raquel Moss @raquelxmoss 14:58
Sudarsan Balaji @artfuldev 14:58