0.3.0 • Published 5 years ago
ember-actions-service v0.3.0
ember-actions-service
ember-actions-service is an Ember Addon to wrap common store and model methods with ember-concurrency tasks and making them available as a service.
Usage
Blueprint:
ember g actions-service user
Route
import Ember from 'ember';
import { actionsMixin } from 'ember-actions-service';
export default Ember.Route.extend(actionsMixin('user'), {});
Template using route-actions
{{user-editor saveAction=(route-action "userActions" user "save")}}
Actions
The following actions perform a ember-concurrency task and return a task instance.
- find
- findAll
- create
- save
- delete
- unload
- rollback
Custom Actions
To implement a new action just include a new task into the service generated following the format bellow:
doSomethingTask: task(function * (store, callback, model){
updatedModel = yield doSomething(model);
return { callback, model: updatedModel };
})
Compatibility
- Ember.js v2.18 or above
- Ember CLI v2.13 or above
Installation
ember install ember-actions-service
License
This project is licensed under the MIT License.