2.0.1 • Published 3 years ago

ember-concurrency-wrap-in-task v2.0.1

Weekly downloads
53
License
MIT
Repository
-
Last release
3 years ago

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.

2.0.1

3 years ago

2.0.0

3 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.0.0

5 years ago