Ember helper for wrapping a function in an ember-concurrency task
MIT License
Ember helper for wrapping a function in an ember-concurrency
task.
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}}
yarn add ember-concurrency ember-concurrency-wrap-in-task
See the Contributing guide for details.
This project is licensed under the MIT License.