Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
ember-cli-fetch-async-button
Advanced tools
Button states, disabling, and promise handling for async actions. Built to support ember-fetch async calls.
This addon is based on the Dockyard ember-cli addon 'ember-cli-async-button'... https://github.com/dockyard/ember-async-button
Implemented with support for fetch. You can read more about fetch here. http://updates.html5rocks.com/2015/03/introduction-to-fetch
& the github polyfill which ember-fetch uses... https://github.com/github/fetch
This adds the initial 'then' handler, which validates the response status before either throwing that response as an error to the 'catch' handler, or returning onto the successful 'then' handler.
v0.2.0 adds support to validate hashes and arrays of promises. The component will initialize
the button's rejected
state if any of the promises in the array or hash cause a throw
.
To use fetch with your ember application, I recommend installing stefanpenner's ember-fetch. https://github.com/stefanpenner/ember-fetch
Basic Usage
{{fetch-async-button class="button"
asyncAction=(action "save")
default="Save"
pending="Saving..."
fulfilled="Saved!" }}
save(cb) {
const user = Ember.Object.create({
user: {
name: this.get('name')
}
});
const promise = fetch(`/api/v2/users/${this.get('model.id')}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'Data-Type': 'json'
},
body: JSON.stringify(user),
credentials: 'include'
});
cb(promise);
promise
.then(response => {
if (response.status >= 200 && response.status < 300) {
return response;
} else {
throw response;
}
})
.then(() => {
console.log('Successfully updated User');
})
.catch(err => {
console.log('Error updating user', err);
});
},
git clone
this repositorynpm install
bower install
ember server
ember test
ember test --server
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.
FAQs
Button states, disabling, and promise handling for async actions. Built to support ember-fetch async calls.
We found that ember-cli-fetch-async-button 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.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.