- 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.
推薦閱讀
- 嵌入式Linux開發技術
- Learning OpenDaylight
- Learning Windows Server Containers
- 嵌入式Linux系統開發:基于Yocto Project
- 竹林蹊徑:深入淺出windows驅動開發
- Linux基礎使用與案例
- Mastering Windows 8 C++ App Development
- μC/OS-III內核實現與應用開發實戰指南:基于STM32
- 嵌入式微系統
- iOS 10快速開發:18天零基礎開發一個商業應用
- VMware Horizon Mirage Essentials
- Mastering Eclipse Plug-in Development
- 樹莓派+傳感器:創建智能交互項目的實用方法、工具及最佳實踐
- Unity AR/VR開發:實戰高手訓練營
- Windows Azure實戰