官术网_书友最值得收藏!

Observables from an interval (interval)

We can create an observable from an interval; this is especially useful if you wish to execute repetitive tasks, and it can be used as a substitution for the setInterval() method. An EventStream created by the interval() method will never end; this method has the following signature:

Bacon.interval(intervalInMilliseconds); 

It receives only one parameter, that is the interval between the events in milliseconds, and it will emit an empty object as the event. Let's say you have run the following code:

Bacon 
.interval(100)
.onValue((event)=>{
console.log(event);
});

If so, you will see the following output:

    {}
{}
{}
{}

It will keep printing an empty object until you kill the program.

主站蜘蛛池模板: 广平县| 云梦县| 什邡市| 定安县| 荆门市| 洮南市| 蓝山县| 增城市| 旬邑县| 温泉县| 林周县| 大渡口区| 衡南县| 姜堰市| 上思县| 海阳市| 黑山县| 利津县| 麻栗坡县| 寻乌县| 丁青县| 晋中市| 阿拉善盟| 天门市| 施秉县| 长葛市| 集安市| 苗栗县| 文山县| 加查县| 波密县| 东至县| 屏东县| 平武县| 化德县| 曲松县| 玉田县| 盈江县| 湘潭县| 公主岭市| 甘德县|