https://github.com/mikkopaderes/ember-async-let
Alias the result of an async call to a new name
https://github.com/mikkopaderes/ember-async-let
Last synced: 2 months ago
JSON representation
Alias the result of an async call to a new name
- Host: GitHub
- URL: https://github.com/mikkopaderes/ember-async-let
- Owner: mikkopaderes
- License: mit
- Created: 2018-03-04T05:56:39.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-05T17:51:48.000Z (about 7 years ago)
- Last Synced: 2025-03-17T23:39:27.729Z (2 months ago)
- Language: JavaScript
- Size: 108 KB
- Stars: 8
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
ember-async-let
==============================================================================Alias the result of an async call to a new name
Installation
------------------------------------------------------------------------------```
ember install ember-async-let
```Usage
------------------------------------------------------------------------------### `{{async-let}}`
A tagless component that prevents a block from rendering until the passed-in promise resolves
#### Async property
```hbs
{{#async-let on=(async-property property) as |resolvedData|}}
{{resolvedData}}
{{/async-let}}
```#### Async function
```javascript
const context = {
methodName(param1, param2) {
return Promise.resolve('foobar');
}
};
``````hbs
{{#async-let on=(async-function context 'methodName' param1AsVariable 'param2-as-string') as |resolvedData|}}
{{resolvedData}}
{{/async-let}}
```#### Component placeholder
This will show a specified component as a placeholder until the async call resolves
```hbs
{{#async-let on=(async-property property) placeholder=(component 'my-spinner') as |resolvedData|}}
{{resolvedData}}
{{/async-let}}
```Contributing
------------------------------------------------------------------------------### Installation
* `git clone `
* `cd ember-async-let`
* `npm install`### Linting
* `npm run lint:js`
* `npm run lint:js -- --fix`### Running tests
* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `npm test` – Runs `ember try:each` to test your addon against multiple Ember versions### Running the dummy application
* `ember serve`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
License
------------------------------------------------------------------------------This project is licensed under the [MIT License](LICENSE.md).