Observable streams addon for Ember CLI projects, using ReactiveX (RxJS).
ember install ember-stream
The primary object available is the stream service, located at /addon/services/stream.js
. You should inject this service into your Ember objects:
streamService: Ember.inject.service( 'stream' ),
This service has the following methods available:
This is an alias to the main Rx library, so that any object using the streamService has direct access to the native Reactive functionality.
Create an observable stream from a function definition. This currently just wraps Rx.Observable.create(), but in the future will support additional Ember-friendly patterns.
Lookup and return a named stream registered on the streamService.
Register an observable stream to a referenceable name. Any observers that are awaiting subscription to this stream will be subscribed at this point.
There are two ways to call this method:
- Pass in a single name and stream instance
- Pass in a key-value hash, where each key is the stream name and its value is the stream instance
Attempt to subscribe an observer or series of callbacks to an observable stream. If no observer is registered under the streamName
, then the subscription will not be setup until the stream is registered.
There are two ways to call this method:
- Pass in the
streamName
and at least one callback function - Pass in the
streamName
and an Rx.Observer object
Removes the named reference to the stream registered to streamName
.
git clone
this repositorynpm install
bower install
For more information on using ember-cli, visit http://www.ember-cli.com/.