当前位置:网站首页>Development skills of rxjs observable custom operator
Development skills of rxjs observable custom operator
2022-07-02 13:46:00 【InfoQ】
import { interval, of } from 'rxjs';
function fancyOperator(source) {
return source;
}
interval(1000)
.pipe(fancyOperator)
.subscribe((value) => console.log(value));



import { interval, Observable } from 'rxjs';
function fancyOperator(source) {
return Observable.create((observer) => {
observer.next('Jerry');
observer.complete();
});
}
interval(1000)
.pipe(fancyOperator)
.subscribe((value) => console.log(value));

import { fromEvent, interval, Observable } from 'rxjs';
import { filter } from 'rxjs/operators';
function filterKey(key) {
return filter((event: KeyboardEvent) => event.key === key);
}
fromEvent(document, 'keyup')
.pipe(filterKey('Enter'))
.subscribe(
(data) => console.log(data) // KeyboardEvent
);










边栏推荐
猜你喜欢
浏览器驱动的下载
TVOC, VOC, VOCs gas detection + Solution
Engineers who can't read device manuals are not good cooks
解答:EasyDSS视频点播时音频是否可以设置为默认开启?
[technology development-22]: rapid overview of the application and development of network and communication technology-2-communication Technology
2022 zero code / low code development white paper [produced by partner cloud] with download
Explanation: here is your UFO, Goldbach conjecture
When tidb meets Flink: tidb efficiently enters the lake "new play" | tilaker team interview
Redis database persistence
BeanUtils--浅拷贝--实例/原理
随机推荐
运维必备——ELK日志分析系统
Qt如何设置固定大小
Chinese name extraction (toy code - accurate head is too small, right to play)
Can automatically update the universal weekly report template, you can use it with your hand!
Why can't d link DLL
【文档树、设置】字体变小
Android kotlin broadcast technology point
[document tree, setting] font becomes smaller
能自动更新的万能周报模板,有手就会用!
Countermeasures for the failure of MMPV billing period caused by negative inventory of materials in SAP mm
uniapp小程序 subPackages分包配置
Security RememberMe原理分析
P3008 [USACO11JAN]Roads and Planes G (SPFA + SLF优化)
P1347 sorting (topology + SPFA judgment ring or topology [inner judgment ring])
A better database client management tool than Navicat
Student course selection information management system based on ssm+jsp framework [source code + database]
Sum of the first n terms of Fibonacci (fast power of matrix)
Explanation of 34 common terms on the Internet
BeanUtils--浅拷贝--实例/原理
Winter vacation daily question - lucky numbers in the matrix