Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

untitled notebook

node v6.14.3
version: master
endpointsharetweet
class Observable { constructor(producer) { this.subscribe = producer } } class Subject extends Observable { constructor() { super(function (observer) { this.observers.push(observer); }); this.observers = []; } next(x) { this.observers.forEach((observer) => observer.next(x)); } complete() { this.observers.forEach((observer) => observer.complete()); } } const observer = { next: (v) => console.log(v), complete: () => console.log('complete'), } const subject$ = new Subject(); subject$.subscribe(observer); subject$.next('hoge'); subject$.next('fuga'); subject$.complete();
Loading…

no comments

    sign in to comment