Skip to content

ottonascarella/pipes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Stream Pipes

A reactive stream implementation in Typescript

Bare minimum. Built only as a study: muscle for async thinking.

import { fromEvent, map, merge, scan, startWith } from 'src/index';

const plus$ = fromEvent('click', document.querySelector('.button-plus'));
const minus$ = fromEvent('click', document.querySelector('.button-minus'));

const span = document.querySelector('span');

plus$.pipe(
  map(x => +1),
  startWith(0),
  merge(minus$.pipe(map(y => -1), startWith(0))),
  scan((a,b) => a + b, 0)
).subscribe(n => span.textContent = n);

About

A reactive stream implementation in Typescript

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published