Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Thinking Reactive in JavaScript - Sphere.it JS Krakow

Thinking Reactive in JavaScript - Sphere.it JS Krakow

Ivan Jovanovic

October 09, 2019
Tweet

More Decks by Ivan Jovanovic

Other Decks in Technology

Transcript

  1. • External service calls • Better performance • Highly testable

    • Abstraction over all async processes • Predictable code • Extendable code
  2. Observer Observer subscribes to an observable and reacts to whatever

    item or sequence of items the observable emits.
  3. Reactive programming in JS • RxJS - the most popular,

    the biggest • MostJS - the best performance • Bacon.js • XStream - the smallest
  4. +

  5. + +

  6. Features • Functional (just write pure functions) • Reactive •

    Testable • Composable • Explicit dataflow • Made for large codebases
  7. Drivers - side effects • HTTP • DOM • WebSockets

    • Local storage driver • HTML5 Notifications driver • …
  8. Cycle.js official packages • DOM - collection of drivers that

    work with DOM; it has DOM driver and HTML driver, based on snabdom virtual DOM library • History - driver for History API • HTTP - driver for HTTP requests, based on superagent • Isolate - function for making scoped dataflow components • Run - `run` function for apps made with `xstream` • Most-run - `run` function for apps made with `most` • RxJS-run - `run` function for apps made with `rxjs`
  9. Conclusion • Old paradigm with the new usage • Not

    for everyone • Perfect for real time apps that require high performance • Testable, predictable code • One interface for all async processes