Wednesday, January 8, 2020

try rxjs in chrome devtool

1)  got o https://rxjs-dev.firebaseapp.com/
2) press F11 to open devtools, you should see the welcome messages, like this
 ____           _ ____     
|  _ \ __  __  | / ___|   
| |_) |\ \/ /  | \___ \ 
|  _ <  >  < |_| |___) |   
|_| \_\/_/\_\___/|____/

started experimenting with RxJS:

type this into the console:

rxjs.interval(500).pipe(rxjs.operators.take(4)).subscribe(console.log)

3) now you can type any code in console to test rxjs
4) one thing need pay attention is that do not use any import since we are inside the js document
if we want use anything in rxjx like this (import { scan } from 'rxjs/operators';)
we should  use it like this
 scan = rxjs.operators.scan;
 fromEvent = rxjs.fromEvent;
fromEvent(document, 'click') .pipe(scan(count => count + 1, 0)) .subscribe(count => console.log(`Clicked ${count} times`));

No comments:

Post a Comment