Skip to content

Commit

Permalink
Pass args from run to defer
Browse files Browse the repository at this point in the history
  • Loading branch information
Exelord committed May 10, 2020
1 parent 20bab4b commit c454f75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
10 changes: 4 additions & 6 deletions addon/components/await/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,13 @@ class AwaitComponent extends Component {
}

@task({ restartable: true, evented: true })
*promiseTask(promise) {
return yield isFunction(promise) ? promise() : promise;
*promiseTask(promise, ...args) {
return yield isFunction(promise) ? promise(...args) : promise;
}

@action
run() {
const { promiseTask, args } = this;

promiseTask.perform(args.defer);
run(...args) {
this.promiseTask.perform(this.args.defer, ...args);
}

@action
Expand Down
11 changes: 4 additions & 7 deletions docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@

# Introduction

>### **Disclaimer**
>
>**Ember Await aims to clone the functionality of [React Async](https://react-async.com) (a react library for handling async state) and bring the solution to Ember ecosystem. As we try to make is as close as possible, not all the features are implemented yet, and not all of them are ported 1:1. Please keep that in mind.**

___

Ember Await delivers a component for declarative promise resolution. Makes it easy to handle every state of the asynchronous process, without assumptions about the shape of your data or the type of request. Use it with fetch, Axios or other data fetching libraries, even GraphQL.

## Rationale
Expand All @@ -27,3 +20,7 @@ Ember Await works well even in larger applications with multiple or nested data
- Highly inspired by [react-async](https://react-async.com)
- Takes advantage of [ember-concurrency](https://ember-concurrency.com/) to manage promise state (aborting, cancellation, etc.)
- ~~Written in TypeScript, ships with type definitions~~

>### **Disclaimer**
>
>**Ember Await aims to clone the functionality of [React Async](https://react-async.com) (a react library for handling async state) and bring the solution to Ember ecosystem. As we try to make is as close as possible, not all of them are ported 1:1 and not all of them make sense in Ember. Please keep that in mind.**

0 comments on commit c454f75

Please sign in to comment.