JSFoo 2014

JavaScript as the centerpiece of a complex web stack

Vasanth Gopal

@vasanthg

Functional Reactive Programming with RxJS

Submitted Aug 9, 2014

Web Applications have changed over the year from simple HTML pages to DHTML to Ajax revolutions. Each time, we are adding more complexity to handle asynchronous behaviour of data and events. How do we react to such asynchronous flow of user events and AJAX Data?

In this talk, I will highlight on how to react to such growing asynchronous behaviour by applying functional reactive programming using Reactive Extensions for JavaScript (RxJS) as an example.

Outline

Any web app has to deal with asynchronous and event-based programming. Although promise pattern is emerging, handling exceptions, cancellation and synchronization is difficult and error prone. The Reactive Extensions for JavaScript (RxJS) unifies both the world of Promises, callbacks as well as evented data such as DOM Input.

RxJS is a set of libraries for composing asynchronous and event-based programs. Every asynchronous data stream (that come from diverse sources, e.g., stock quote, tweets, computer events, web service requests, etc.) and user event stream is represented using the Observer object. Functions can then subscribe to such Observer and gets notified when an event occurs. Once notified, query operations like filter, project, aggregate, compose and time-based operations can be performed on those multiple event data by using RxJS operators.

Cancellation, exceptions, and synchronization are handled gracefully by using the methods on the Observable object.

A synopsis of this talk:

  • What is Functional Reactive Programming and How RxJS applies it?

  • Different operations defined in RxJS with examples.

  • How do we observe and subscribe to events?

  • An use case example using RxJS.

Speaker bio

Vasanth Gopal, a Software Engineer at Indix, works on design & development of multiple web apps at Indix.

He has kickstarted apps, brought it to beta and scaled it for use by multiple customers. He has gone through phases starting from a concept to a prototype to a production ready version. He focuses on Front end development and on helping the engineering team deliver features rich in usability.

https://github.com/Vasanth-Indix

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Hosted by

JSFoo is a forum for discussing UI engineering; fullstack development; web applications engineering, performance, security and design; accessibility; and latest developments in #JavaScript. Follow JSFoo on Twitter more