Sunday, 15 March 2015

javascript - bacon.js EventStream representing polling of url at interval -



javascript - bacon.js EventStream representing polling of url at interval -

i want poll url regularly , results stream. i'm missing obvious know how seemingly simple thing in bacon.js?

figured out, poll /whatever every 5 seconds , homecoming results stream of values:

var ajaxe = function() { homecoming bacon.frompromise( $.ajax({ type: "get", url: "/whatever", datatype: "json" }) ); }; var stream = bacon.interval(5000).flatmaplatest(ajaxe);

explained here: http://nullzzz.blogspot.com/2012/12/baconjs-tutorial-part-iii-ajax-and-stuff.html (section titled "ajax flatmap").

javascript ajax events polling bacon.js

No comments:

Post a Comment