当前位置:网站首页>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
);










边栏推荐
猜你喜欢

Drawing Nyquist diagram with MATLAB

Node.js通过ODBC访问PostgreSQL数据库

题解《子数整数》、《欢乐地跳》、《开灯》

Three methods of finding LCA of the nearest common ancestor

Why is the default of switch followed by break?

OpenFOAM:lduMatrix&lduAddressing

The 29 year old programmer in Shanghai was sentenced to 10 months for "deleting the database and running away" on the day of his resignation!

Countermeasures for the failure of MMPV billing period caused by negative inventory of materials in SAP mm

诚邀青年创作者,一起在元宇宙里与投资人、创业者交流人生如何做选择……...
![Unity small map production [2]](/img/d6/9d6556d37525b9986b74133f2a7aaa.jpg)
Unity small map production [2]
随机推荐
Three methods of finding LCA of the nearest common ancestor
Memory management 01 - link script
Why can't d link DLL
OpenFOAM:lduMatrix&lduAddressing
linux下清理系统缓存并释放内存
What are eNB, EPC and PGW?
Qt入门-制作一个简易的计算器
Tupang multi-target tracking! BOT sort: robust correlated multi pedestrian tracking
ensp简单入门
P1347 sorting (topology + SPFA judgment ring or topology [inner judgment ring])
Partner cloud form strong upgrade! Pro version, more extraordinary!
Origin绘制热重TG和微分热重DTG曲线
Explanation of 34 common terms on the Internet
Countermeasures for the failure of MMPV billing period caused by negative inventory of materials in SAP mm
Pointer from entry to advanced (1)
诚邀青年创作者,一起在元宇宙里与投资人、创业者交流人生如何做选择……...
BeanUtils--浅拷贝--实例/原理
解答:EasyDSS视频点播时音频是否可以设置为默认开启?
De4000h storage installation configuration
Dingtalk 发送消息