0.0.43 • Published 1 year 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
1 year ago
0.0.42
3 years ago
0.0.41
3 years ago
0.0.40
3 years ago
0.0.38
3 years ago
0.0.39
3 years ago
0.0.37
3 years ago
0.0.36
3 years ago
0.0.35
3 years ago
0.0.34
3 years ago
0.0.33
3 years ago
0.0.32
3 years ago
0.0.31
4 years ago
0.0.28
4 years ago
0.0.18
4 years ago
0.0.17
4 years ago
0.0.15
4 years ago
0.0.16
4 years ago
0.0.14
4 years ago
0.0.12
4 years ago
0.0.11
4 years ago
0.0.10
4 years ago
0.0.9
4 years ago
0.0.8
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago