Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
async-container
Advanced tools
This addon enables a declarative way to react to actions which return a promise. When dealing with actions, it's common to represent the UI state while an async action is resolving. For example, a save button that needs to be disabled while a save request is in flight.
{{!-- templates/example.hbs --}}
{{#async-container (action 'save') as |async|}}
<button {{action async.invoke}} disabled={{async.inFlight}}>
{{#if async.inFlight}}
Saving
{{else}}
Save
{{/if}}
</button>
{{/async-container}}
The result of the last successful promise result is available on async.result
{{!-- templates/example.hbs --}}
{{#async-container (action 'save') as |async|}}
{{#if async.result}}
Thank you {{async.result.username}}
{{else}}
<button {{action async.invoke}} disabled={{async.inFlight}}>
{{#if async.inFlight}}
Saving
{{else}}
Save
{{/if}}
</button>
{{/if}}
{{/async-container}}
// controllers/example.js
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
save() {
return this.get('model').save();
}
}
});
ember install async-container
ember server
npm test
(Runs ember try:testall
to test your addon against multiple Ember versions)ember test
ember test --server
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.
FAQs
A utility component to react to promise state changes in the DOM.
The npm package async-container receives a total of 0 weekly downloads. As such, async-container popularity was classified as not popular.
We found that async-container demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.