Skip to content

Commit

Permalink
Add docs for autosubscribe mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Radchenko committed Apr 8, 2016
1 parent 5710188 commit d3eeb24
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,25 @@ The idea came from [Robert Jackson].

## Usage

```js
import Ember from 'ember';
import AutosubscribeMixin from 'ember-query-params/mixins/autosubscribe';

export default Ember.Controller.extend(AutosubscribeMixin, {
queryParams: [
'theme',
{ isSidebarOpen: 'sidebar' }
],
isSidebarOpen: false,
theme: 'default'
});
```

This will use `paramsRelay.autoSubscribe(controller)` on `init` and later
tear down on `willDestroy`. You also get a couple proxy methods, `subscribeParam` and
`unsubscribeParam` which work the same as the equivalent methods on the service.
Or you can use the service directly for maximum control.

```js
import Ember from 'ember';

Expand Down

0 comments on commit d3eeb24

Please sign in to comment.