# RxJS - Practice makes Perfect - Jan-Niklas Wortmann ###### tags: `jsdc2019` {%hackmd @JSDC-tw/2019-announcement %} ## Observables Observables reactive mindset -> challenge ## Imperative vs Reactive programming - `array[0]` -> `first` - `[...array]` -> `toArray` - `getDate()` -> `getDate().subscribe()` why? > Thinking in Reactive way has challenges ## Live Coding 實作圖片的 Swipe 功能 1. Listen touch mouse events with composing `fromEvent` functions 2. Apply and `pipe` for data update ```javascript // combine event => merge( fromEvent(document, 'mousedown'), fromEvent(document, 'touchdown') ) ``` - Performance tweak by animationFrameScheduler - don't forget to unsubscribe! - don't forget to subscribe! - add keyboard navigation for left/right arrows ## What about v7 and beyond - Improve Typings (with TypeScript) - AnimationFrame Observable ## Summary - Practice with - Redo the same - Drag N' Drop - Typeahead Search - Longpolling ## Links - [slide](https://rxjs-practice-makes-perfect.dev) - [niklas_wortmann@dev.to](https://dev.to/niklas_wortmann) - [niklas_wortmann@Twitter](https://twitter.com/niklas_wortmann) - [niklas_wortmann@GitHub](https://github.com/JWO719)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up