Skip to content

tarmann/ember-actions-service

Repository files navigation

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.

Build Status Maintainability Test Coverage Ember Observer Score

Usage

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")}}

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.

About

Ember model, store and custom methods as task actions.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •