javascript - Kefir.js - How to stream events from a callback function? -
the mousetrap.js library lets bind callback function keys so:
mousetrap.bind('space', function, 'keydown');
what's best way attach stream without using bus of doom? should use emitter
or pool
?
i'm trying arrow keys hooked in fiddle: jsfiddle.net/vzafq25w
you can use general wrapper stream
var leftkeys = kefir.stream(function(emitter){ mousetrap.bind('left', function(e) { emitter.emit(e); console.log(e); }); return function(){ // unbind }; });
Comments
Post a Comment