Asynchronous programming is a crucial part of JavaScript but can prove challenging. In the beginning, it was managed with callbacks, which unfortunately led to callback hell. Next, came Promises, which untangled the nested callbacks and yielded powerful mapping constructs over eventual values. However, even with Promises, it was difficult to express meaningful, readable control flow and manage errors. While these patterns are still useful, their limitations have become apparent. In this talk, explore two newer patterns for managing asynchronous code with more meaningful semantics. First, learn about async functions, which will land in the ES2017 spec of JavaScript. Async functions allow asynchronous code to be written in a synchronous manner and are already natively available in some browsers. Investigate several use cases and “gotchas” of async functions and learn how they work with Promises. Next, discover Observables via RxJS and how they provide a more powerful construct for operating on eventual values similar to Promises. Observables offer a more robust and meaningful API compared to Promises and can easily work with various event sources such as DOM events, WebSockets, and REST API’s. Leave this talk with better confidence and ability to handle asynchronous code in JavaScript.
Jeremy Fairbank is a remote web developer in Tennessee. He works for Sigient with an entirely distributed team that creates amazing designs and software. He has worked on the front-end and back-end extensively with React, Redux, Angular, Backbone, Marionette, and Ruby on Rails. He blogs at blog.jeremyfairbank.com and has been featured in JavaScript Weekly a few times. Outside of developing, he enjoys being a husband and father and playing guitar.