ember-concurrency-wrap-in-task

2.0.1 • Public • Published

ember-concurrency-wrap-in-task

Ember helper for wrapping a function in an ember-concurrency task.

Usage

This addon is to help migrate from using an async Ember Action to Ember Concurrency tasks.

Rather than having to re-write your JS code to take advantage of the derived state that Ember Concurrency provides, you can pass an action through this helper to receive a task that wraps it.

{{#let (wrap-in-task @someArgumentFunction) as |task|}}
  <button {{on "click" (perform task)}} disabled={{task.isRunning}}>
    {{if task.isRunning "Running..." "Run"}}
  </button>
{{/let}}

A "task type" (drop, keepLatest) can be provided as a named parameter to the helper. maxConcurrency can also be configured in a similar way.

{{wrap-in-task @someArgumentFunction type="drop" maxConcurrency=3}}

Installation

yarn add ember-concurrency ember-concurrency-wrap-in-task

Compatibility

  • Ember.js v3.4 or above
  • Ember CLI v2.13 or above
  • Node.js v8 or above

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Readme

Keywords

Package Sidebar

Install

npm i ember-concurrency-wrap-in-task

Weekly Downloads

18

Version

2.0.1

License

MIT

Unpacked Size

9.23 kB

Total Files

11

Last publish

Collaborators

  • alexlafroscia