A button that disables itself until the promise is resolved. See the provided animations below.
Default values work with Bootstrap and Font Awesome, but you can adjust it to your needs.
Your template:
<template>
<require from="path/to/promise-button"></require>
<promise-button on-click.call="save()"
waiting-text="Saving"
success-text="Saved"
failure-text="Error">
Save me
</promise-button>
</template>
And a component:
export class MyComponent {
save() {
return new Promise((resolve) => setTimeout(resolve, 2000));
}
}