Juan Herrera
Google Developer Expert in Angular & Web Technologies
@jdjuan
4 MONTHS AGO
PARKSIDE.AT
Google Developer Expert
Google Developer Expert
Ask me how to become a:
⭐️ Google Developer Expert ⭐️
@jdjuan
@jdjuan
Pietro Ferrari
My dad
THE PROBLEM
Writing asynchronous code sometimes feels like this:
Backend developers right now...
JavaScript
Callbacks
Promises
RxJS
HTTP Request
@jdjuan
@jdjuan
@jdjuan
@jdjuan
Operators
Observables
"Our developers couldn't understand observables' charts so instead they decided to build a game: Candy Crush"
Candy Crush CEO
Fake news
ANALOGY
2. Observer
3. Subscription
4. Content
observable = http.get(url);
observable.subscribe(console.log);
observable = http.get(url);
observable.subscribe((data)=>{
console.log(data);
});
const users$ = http.get(url);
users$.subscribe((data)=>{
console.log(data);
});
const users$ = http.get(url);
...
users$.subscribe();
// app.component.ts
this.users$ = http.get(url);
// app.component.html
<div *ngIf="(users$ | async) as users">
@jdjuan
OBSERVABLES
🙋♀️
🙋♀️
🙋♀️
🙋♀️
@jdjuan
Lazy
@jdjuan
Lazy
Cancellable
@jdjuan
Lazy
Cancellable
Multiple
@jdjuan
@jdjuan
Lazy
Cancellable
Multiple
Operators
@jdjuan
"RxJS operators are like Lodash functions, but for events"
@jdjuan
"RxJS operators are like jquery, except that they won't die"
Hopefully 😰
@jdjuan
@jdjuan
@jdjuan
@jdjuan
@jdjuan
THANK YOU!
By Juan Herrera