- 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.
推薦閱讀
- Ansible權威指南
- VMware Horizon View 6 Desktop Virtualization Cookbook
- 玩到極致 iPhone 4S完全攻略
- Linux自動化運維:Shell與Ansible(微課版)
- 移動應用UI設計模式(第2版)
- Linux系統安全基礎:二進制代碼安全性分析基礎與實踐
- Mastering Reactive JavaScript
- Linux服務器配置與管理
- 計算機應用基礎(Windows 7+Office 2016)
- Drupal 7 Cookbook
- Ubuntu Linux操作系統實用教程
- Learn Quantum Computing with Python and IBM Quantum Experience
- OpenStack Essentials(Second Edition)
- Less Web Development Essentials
- openEuler操作系統核心技術與行業應用實踐