Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@gavant/ember-button-spinner
Advanced tools
A button component built on @gavant/ember-button-basic that accepts an action that returns a promise, and displays a spinner while waiting for the promise to resolve. Also optionally shows a "success" icon if the promise resolves, and "shakes" if the promise rejects.
ember install @gavant/ember-button-spinner
To use the addon styles, you must use SASS:
ember install ember-cli-sass
(Upon addon installation, an import statement will be added to your app.scss
)
NOTE: This addon uses FontAwesome 5 (@fortawesome/ember-fontawesome) for icon support. However it does NOT install any icon set packages. You must install these separately, following the addon's installation guide, e.g.
yarn add --dev @fortawesome/free-solid-svg-icons
An example <ButtonSpinner>
usage, with all available arguments used. Note that all arguments provided by the base <Button>
component are supported too, but are not all listed here. See the addon's usage documentation for details. None of the component arguments are required.
<ButtonSpinner
@action={{function}}
@label={{string}}
@isSpinning={{boolean}}
@showSuccess={{boolean}}
@showError={{boolean}}
@loadingClass={{string}}
@successClass={{string}}
@successAnimationClass={{string}}
@successIcon={{string}}
@successIconClass={{string}}
/>
{{!-- block form is supported too --}}
<ButtonSpinner @action={{this.someAction}}>
Look ma, block content!
</Button>
In order for the button to show the spinner animation, the function passed to @action
must return a Promise (or be an async
function). If the returned promise resolves or rejects with another function, the component will invoke that function as a callback when the button's success or error animation completes. This can be useful in situations where you want to execute some logic after the animation is displayed to the user, such as transitioning to another page. For example:
@action
async saveAndTransition() {
await this.someAsyncSaveLogic();
//resolve with a function that will be executed once the success animation finishes
return () => this.transitionToRoute('somewhere.else');
}
<ButtonSpinner
@action={{this.saveAndTransition}}
@label="Transitions after success!"
/>
See the Contributing guide for details.
This project is licensed under the MIT License.
FAQs
Spinner button that handles promises
The npm package @gavant/ember-button-spinner receives a total of 16 weekly downloads. As such, @gavant/ember-button-spinner popularity was classified as not popular.
We found that @gavant/ember-button-spinner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.