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










边栏推荐
- Unity skframework framework (XII), score scoring module
- 题解:《压缩技术》(原版、续集版)
- rxjs Observable 自定义 Operator 的开发技巧
- Achievements in science and Technology (27)
- Origin绘制热重TG和微分热重DTG曲线
- Japan bet on national luck: Web3.0, anyway, is not the first time to fail!
- Which do you choose between Alibaba P7 with an annual salary of 900000 and deputy department level cadres?
- When tidb meets Flink: tidb efficiently enters the lake "new play" | tilaker team interview
- 浏览器驱动的下载
- Memory management 01 - link script
猜你喜欢

selenium 在pycharm中安装selenium

大家信夫一站式信用平台让信用场景“用起来

Daily practice of C language --- monkeys divide peaches

Drawing Nyquist diagram with MATLAB

Web基础

How to modify the error of easydss on demand service sharing time?

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

操作教程:EasyDSS如何将MP4点播文件转化成RTSP视频流?

运维必备——ELK日志分析系统

De4000h storage installation configuration
随机推荐
Node.js通过ODBC访问PostgreSQL数据库
能自动更新的万能周报模板,有手就会用!
Solve "sub number integer", "jump happily", "turn on the light"
D为何链接不了dll
诚邀青年创作者,一起在元宇宙里与投资人、创业者交流人生如何做选择……...
selenium 在pycharm中安装selenium
JS reverse massive creative signature
A better database client management tool than Navicat
mysql ---- Oracle中的rownum转换成MySQL
On flow delivery between microservices
Principle analysis of security rememberme
Halcon extract orange (Orange)
[youcans' image processing learning course] general contents
混沌工程平台 ChaosBlade-Box 新版重磅发布
numpy数组计算
浏览器驱动的下载
伙伴云表格强势升级!Pro版,更非凡!
2022 Heilongjiang provincial examination on the writing skills of Application Essays
[unity] using GB2312, the solution to abnormal program after packaging
OpenApi-Generator:简化RESTful API开发流程