Skip to content

b-laporte/rx-await

Repository files navigation

Rx-Await: Bridging Observables and async/await

tl;dr rx-await allows to use async functions instead of pipe operators in Observable streams

Key features

  • simple async/await mental model for stream transformation
  • 4 simple operators to easily build all others (task / cancel / callStackContext / promise)
  • operators are simple functions
  • need for much less operators than with traditional ReactiveX implementations - as many can be replaced by a few lines of code (e.g. if instead of filter)
  • less need to combine streams as they appear as functions in functions, so sub-streams can access their parent closure and interact with their parent streams directly.

Core concept

Rx-Await core idea is to be able to write observable transformations as async functions like this:

Intro

High-level principles and examples can be found in these slides (note: this presentation assumes that readers are familiar with async/await and Observables concepts).

Build steps

Rx-Await requires a file pre-processing step to process task functions (i.e. the functions with a $$ parameter). The current implementation only offers a rollup plugin (cf. root folder).

Building the project

In its current state Rx-Await is not available in npm - but the project is quite easy to build:

To retrieve all dependencies:

yarn install

To run all tests:

yarn test

To run the type-ahead example:

yarn build-samples && http-server

... then open your browser on http://127.0.0.1:8080/dist/typeahead/

About

Observables with async/await

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published