Skip to content

Instantly share code, notes, and snippets.

@wheeyls
Created February 9, 2013 03:11
Show Gist options
  • Save wheeyls/4743675 to your computer and use it in GitHub Desktop.
Save wheeyls/4743675 to your computer and use it in GitHub Desktop.
riffle.js is a little nicer and more transparent than bacon.js
// call this separately to load the lib...
$.getScript('https://rawgithub.com/flowgrammer/Riffle/master/riffle.js').then(function () {
var clicks = stream(function (outFn, selector) {
$(selector).on('click', function (ev) {
outFn($(this));
});
})
, hrefs = stream(function (outFn, $element) {
outFn($element.attr('href'));
})
;
hrefs.input(clicks);
clicks.invoke('[data-focus-id] > a');
hrefs.onOutput(function (href) {
console.log(href);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment