RxJS Playground

A blank canvas to play / experiment with RxJS: https://github.com/Reactive-Extensions/RxJS

by skeemer

HTML

<script src="https://unpkg.com/rxjs/bundles/rxjs.umd.min.js"></script>

JavaScript

const { Observable, Subject, ReplaySubject, from, of, range, pairs } = rxjs;
const { map, filter, switchMap } = rxjs.operators;


console.clear();

const data = {
  "blocks": {
    "block001": {
      "owner": "y2AGW5q3iPSJDKA5KrIy8GaBqVm2",
      "editors": {
        "02Du6IocRrSrHd0e5AyfK6klNOm1": true,
        "DfSO4FamtEQwZbmIi321dBGSVun1": true,
        "tYXo33dzqLcixmYlkoPhpcxctAC3": true
      },
      "readers": {
        "fWiTpQ2xyINV5rUjVFJoHhUKdlT2": true
      }
    }
  },
  "users": {
    "y2AGW5q3iPSJDKA5KrIy8GaBqVm2": {
      "name": "100"
    },
    "02Du6IocRrSrHd0e5AyfK6klNOm1": {
      "name": "200"
    },
    "DfSO4FamtEQwZbmIi321dBGSVun1": {
      "name": "201"
    },
    "tYXo33dzqLcixmYlkoPhpcxctAC3": {
      "name": "202"
    },
    "fWiTpQ2xyINV5rUjVFJoHhUKdlT2": {
      "name": "300"
    }
  }
};

const data2 = [];
pairs(data.users)
	.pipe(map(pair => pair[0]))
  .subscribe(key => data2.push(key));
console.log('done', JSON.stringify(data2));


/* var o1 = Observable.range(1, 1).delay(2500);
var o2 = Observable.range(2, 1).delay(3500);
o1.subscribe(x => console.log('x:', x));
o2.subscribe(y => console.log('y:', y));
o2.combineLatest(o1).subscribe((a) => console.log('a', a));
o1.combineLatest(o2).subscribe((b) => console.log('b', b));
 */
 /*
var subject = new Subject();

subject.subscribe({
  next: (v) => console.log('observerA: ' + v)
});
subject.subscribe({
  next: (v) => console.log('observerB: ' + v)
});

var observable = from([1, 2, 3]);
var observable2 = from([4, 5, 6]);
*/
//observable.subscribe(subject);
//observable2.subscribe(subject);