Skip to content

Commit

Permalink
v1.3.0
Browse files Browse the repository at this point in the history
- Add `setParams` method
  • Loading branch information
Ilya Radchenko committed Apr 8, 2016
1 parent 8edbc58 commit 18cface
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ Function signature `paramsRelay.setParam('name', value)`.

Function signature `paramsRelay.getParam('name')`. Returns the value, can be anything.

#### `setParams`

Function signature `paramsRelay.setParams(obj)`.
A helper method to set many query params at once. Suggested usage includes
using in the route, i.e. `paramsRelay.setParams(this.paramsFor(this.routeName))`.

#### `subscribe`

Function signature `paramsRelay.subscribe('name', (key, value) => { //do something });`.
Expand Down
7 changes: 7 additions & 0 deletions addon/mixins/query-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ export default Ember.Mixin.create({
return item ? item.value : undefined;
},

setParams(hash) {
Object.keys(hash).forEach(key => {
let value = hash[key];
this.setParam(key, value);
});
},

subscribe(name, cb) {
let map = this._map;
let item = map[name];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-query-params",
"version": "1.2.0",
"version": "1.3.0",
"description": "Ember service for your query params",
"directories": {
"doc": "doc",
Expand Down

0 comments on commit 18cface

Please sign in to comment.