[rxjs] Async, handle data over time

If I have an array, and I want to apply filter, map, forEach to it.

let Observable = Rx.Observable;

let ary = Observable.fromArray([1,2,5,4,6]);

ary
.filter((item) => item % 2===1)
.map((item)=> item + "!")
.forEach((item) => console.log(item));
/*
"1!"
"5!"
*/

The same opreations filter, map, foreach can also handler async data which arrive over time:

let Observable = Rx.Observable;

let ary = Observable.interval(500).take(8);

ary
.filter((item) => item % 2===1)
.map((item)=> item + "!")
.forEach((item) => console.log(item)); /**
"1!"
"3!"
"5!"
"7!"
*/
上一篇:[搬砖]Pycharm中启动IPython notebook失败提示load_entry_point ImportError: Entry point ('console_scripts', 'ipython') not found的解决方法


下一篇:TLD网络资源汇总--学习理解之(四)