- Mastering Reactive JavaScript
- Erich de Souza Oliveira
- 114字
- 2021-07-09 20:33:07
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.
推薦閱讀
- Citrix XenApp Performance Essentials
- 每天5分鐘玩轉(zhuǎn)Kubernetes
- Mobile-first Bootstrap
- Linux性能優(yōu)化
- 深入Linux內(nèi)核架構(gòu)與底層原理(第2版)
- 移動(dòng)應(yīng)用UI設(shè)計(jì)模式(第2版)
- Windows Server 2019 Administration Fundamentals
- Windows 7案例教程
- 突破平面3ds Max動(dòng)畫設(shè)計(jì)與制作
- Mastering Reactive JavaScript
- 計(jì)算機(jī)系統(tǒng):基于x86+Linux平臺(tái)
- 跟老男孩學(xué)Linux運(yùn)維:Shell編程實(shí)戰(zhàn)
- Ubuntu Linux操作系統(tǒng)實(shí)用教程
- Getting Started with UDK
- Mastering Azure Serverless Computing