0.0.43 • Published 2 years ago
@keiii/k-stream v0.0.43
Functional reactive stream library for TypeScript
K-Stream is yet another a library for reactive programming using Observables, to make it easier to compose asynchronous or callback-based code.
npm i @keiii/k-stream
Usage
import { ksPeriodic, ksShare, ksFilterMap, ksTake, some, none } from "@keiii/k-stream";
const stream = ksPeriodic(100, ksShare)
.pipe(ksFilterMap(n => (n % 2 === 0 ? some(n) : none)))
.pipe(ksTake(10));
stream.subscribe({
next: console.log,
complete: () => console.log('complete!'),
});
Create steam from your data source:
const stream = ksShare<MouseEvent>(observer => {
const handler = (e: MouseEvent) => observer.next(e);
document.addEventListener('click', handler);
return { unsubscribe: () => document.removeEventListener('click', handler) };
});
Goals
- RxJS like syntax
- “Hot” streams stay “Hot” after pipe usage (https://github.com/ReactiveX/rxjs/issues/1148)
- Type safe, no “any”
- Either data type as an alternative to throwing exceptions
0.0.43
2 years ago
0.0.42
4 years ago
0.0.41
4 years ago
0.0.40
4 years ago
0.0.38
4 years ago
0.0.39
4 years ago
0.0.37
4 years ago
0.0.36
4 years ago
0.0.35
4 years ago
0.0.34
4 years ago
0.0.33
4 years ago
0.0.32
4 years ago
0.0.31
5 years ago
0.0.28
5 years ago
0.0.18
5 years ago
0.0.17
5 years ago
0.0.15
5 years ago
0.0.16
5 years ago
0.0.14
5 years ago
0.0.12
5 years ago
0.0.11
5 years ago
0.0.10
5 years ago
0.0.9
5 years ago
0.0.8
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago