zebulonj / callbag-subscribe

A callbag sink (listener) that connects an Observer a-la RxJS. 👜
MIT License
18 stars 5 forks source link

Return disposal function on subscribe... #1

Closed zebulonj closed 6 years ago

zebulonj commented 6 years ago

...to allow external initiation of termination (unsubscribe).

const source = fromEvent( ... );
const observer = {
  next: val => console.log( val )
};

const dispose = subscribe( observer )( source );
dispose();