BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Async, LINQ, and the Future of RxJS

| by Jonathan Allen Follow 5 Followers on Dec 23, 2013. Estimated reading time: 1 minute |

Reactive Extensions for JavaScript 2.2 includes an optional component for working with asynchronous data sources. Known as rx.async.js, this fulfills the need for binding to events, callbacks, and promises.

For standard events the Rx.Observable.fromEvent function simply requires the object holding the event and the event name. For custom events, Rx.Observable.fromEventPattern allows you to pass in separate functions for attaching and detaching the event handler.

Converting a promise to an observable is just as easy. After constructing the promise, wrap it with the Rx.Observable.fromPromise function.

Callbacks are of course an import consideration for JavaScript developers, especially those using Node.js. So Async RxJS offers wrappers for both standard and Node style callbacks. The latter assumes the first parameter of the callback is used to convey error information.

RxJS Future

On the roadmap for the future versions is query expression parsing. Like .NET’s LINQ, this will allow developers to create queries at runtime against data sources such as IndexedDB and OData. While OData should cover most scenarios, this could conceivably open the door for the creation of other LINQ-like providers.

Another concern that the Rx wants to address is back pressure. This would allow the Observer to throttle back the source when the incoming messages are too frequent for it to handle.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Test Comment by Jonathan Allen

Please Delete

Re: Test Comment by Jonathan Allen

Test Reply. Please delete.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

2 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT