Ember model, store and custom methods as task actions.
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.
Blueprint:
ember g actions-service user
Route
import Route from '@ember/routing/route';
import { actionsMixin } from 'ember-actions-service';
export default Route.extend(actionsMixin('user'), {});
Template using route-actions
{{user-editor saveAction=(route-action "userActions" user "save")}}
The following actions perform a ember-concurrency task and return a task instance.
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 };
})
ember install ember-actions-service
This project is licensed under the MIT License.