Skip to content

Commit

Permalink
feat: simplify the usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rengert committed Dec 23, 2023
1 parent 59a55a4 commit 16344f6
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
})
export class ButtonComponent {
@Input({ required: true }) type!: 'raised' | 'stroked';
@Input({ required: true }) function!: () => Promise<void> | void;

@Input({ required: false }) color: 'primary' | 'accent' | 'warn' = 'primary';
@Input({ required: false }) loading = false;

@Input({ required: false }) function: () => Promise<void> | void = () => {
};
protected loading = false;

protected async click(): Promise<void> {
this.loading = true;
await (this.function ? this.function() : Promise.resolve());
await this.function();
this.loading = false;
}
}

0 comments on commit 16344f6

Please sign in to comment.