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

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.

主站蜘蛛池模板: 大城县| 绥德县| 星座| 元谋县| 彭泽县| 苍溪县| 游戏| 阜新市| 榕江县| 西丰县| 池州市| 巴塘县| 河间市| 盘山县| 安新县| 乳山市| 潢川县| 宁津县| 上栗县| 商河县| 文成县| 辉县市| 阳信县| 高碑店市| 巴林左旗| 英超| 亚东县| 万州区| 平阳县| 墨脱县| 金昌市| 宁波市| 开远市| 东城区| 广德县| 德阳市| 迁安市| 乐安县| 蒲城县| 鸡东县| 治县。|