https://github.com/jasonmit/ember-stream
Observable streams addon for Ember CLI
https://github.com/jasonmit/ember-stream
Last synced: about 2 months ago
JSON representation
Observable streams addon for Ember CLI
- Host: GitHub
- URL: https://github.com/jasonmit/ember-stream
- Owner: jasonmit
- License: mit
- Created: 2015-07-23T21:41:41.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-07-23T21:42:02.000Z (almost 10 years ago)
- Last Synced: 2025-02-10T04:44:09.302Z (4 months ago)
- Language: JavaScript
- Size: 113 KB
- Stars: 0
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Ember Stream [](https://www.npmjs.com/package/ember-stream)
Observable streams addon for Ember CLI projects, using [ReactiveX](http://reactivex.io) ([RxJS](https://github.com/Reactive-Extensions/RxJS)).
## Use in Ember CLI
```bash
ember install ember-stream
```### Stream Service
The primary object available is the stream service, located at `/addon/services/stream.js`. You should inject this service into your Ember objects:
```javascript
streamService: Ember.inject.service( 'stream' ),
```This service has the following methods available:
##### Rx
This is an alias to the main Rx library, so that any object using the streamService has direct access to the native Reactive functionality.
##### createStream( func )
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.
##### findStream( streamName )
Lookup and return a named stream registered on the streamService.
##### registerStream( streamsObjectOrName, stream )
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##### subscribeTo( streamName, observerOrOnNext, onError, onCompleted )
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##### unregisterStream( streamName )
Removes the named reference to the stream registered to `streamName`.
## Installation
- `git clone` this repository
- `npm install`
- `bower install`For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).