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










边栏推荐
- 基于ssm+jsp框架实现的学生选课信息管理系统【源码+数据库】
- What are eNB, EPC and PGW?
- qt中uic的使用
- 能自动更新的万能周报模板,有手就会用!
- Add sequence number column to query results in MySQL
- Student course selection information management system based on ssm+jsp framework [source code + database]
- Redis数据库持久化
- selenium的特点
- Can automatically update the universal weekly report template, you can use it with your hand!
- Node. JS accessing PostgreSQL database through ODBC
猜你喜欢
[技术发展-22]:网络与通信技术的应用与发展快速概览-2- 通信技术
How to modify the error of easydss on demand service sharing time?
Solution: Compression Technology (original version and sequel version)
Performance optimization of memory function
刚好1000粉丝,记录一下
[indomitable medal activity] life goes on and writing goes on
Chinese name extraction (toy code - accurate head is too small, right to play)
Qt入门-制作一个简易的计算器
[cloud native database] what to do when encountering slow SQL (Part 1)?
TVOC, VOC, VOCs gas detection + Solution
随机推荐
[cloud native database] what to do when encountering slow SQL (Part 1)?
刚好1000粉丝,记录一下
Partner cloud form strong upgrade! Pro version, more extraordinary!
JS reverse massive creative signature
Download files and preview pictures
Explanation: here is your UFO, Goldbach conjecture
Qt-制作一个简单的计算器-实现四则运算-将结果以对话框的形式弹出来
Security RememberMe原理分析
Unity skframework framework (XII), score scoring module
Engineers who can't read device manuals are not good cooks
[技术发展-22]:网络与通信技术的应用与发展快速概览-2- 通信技术
[USACO05JAN]Watchcow S(欧拉回路)
二、帧模式 MPLS 操作
Clean up system cache and free memory under Linux
石子合并板子【区间DP】(普通石子合并 & 环形石子合并)
How to use SAP's metadata framework (MDF) to build custom business rules?
科技的成就(二十七)
Independent and controllable 3D cloud CAD: crowncad enables innovative design of enterprises
Node.js通过ODBC访问PostgreSQL数据库
每日一题:1175.质数排列