Skip to content

Commit d028a9d

Browse files
feat(core): Allow all callbacks to be async
1 parent f372e22 commit d028a9d

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

source/ui/components/SettingListItem.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ export type SettingListItemOptions = ThisType<SettingListItem> &
99
/**
1010
* Will be invoked when the user checks the checkbox.
1111
*/
12-
readonly onCheck?: (isBatchProcess?: boolean) => void;
12+
readonly onCheck?: (isBatchProcess?: boolean) => void | Promise<void>;
1313

1414
/**
1515
* Will be invoked when the user unchecks the checkbox.
1616
*/
17-
readonly onUnCheck?: (isBatchProcess?: boolean) => void;
17+
readonly onUnCheck?: (isBatchProcess?: boolean) => void | Promise<void>;
1818

1919
/**
2020
* Should the user be prevented from changing the value of the input?

source/ui/components/SettingTriggerListItem.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { TriggerButton } from "./buttons/TriggerButton.js";
88

99
export type SettingTriggerListItemOptions = ThisType<SettingTriggerListItem> &
1010
SettingListItemOptions & {
11-
readonly onRefreshTrigger?: () => unknown | Promise<unknown>;
12-
readonly onSetTrigger: () => unknown | Promise<unknown>;
11+
readonly onRefreshTrigger?: () => void | Promise<void>;
12+
readonly onSetTrigger: () => void | Promise<void>;
1313
};
1414

1515
export class SettingTriggerListItem extends SettingListItem {

source/ui/components/UiComponent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export type UiComponentInterface = EventTarget & {
99

1010
export type UiComponentOptions = {
1111
readonly children?: Array<UiComponentInterface>;
12-
readonly onClick?: (event?: MouseEvent) => void;
13-
readonly onRefresh?: () => void;
12+
readonly onClick?: (event?: MouseEvent) => void | Promise<void>;
13+
readonly onRefresh?: () => void | Promise<void>;
1414
};
1515

1616
export abstract class UiComponent extends EventTarget implements UiComponentInterface {

source/ui/components/buttons/TriggerButton.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type TriggerButtonBehavior = "integer" | "percentage";
1414

1515
export type TriggerButtonOptions = ThisType<TriggerButton> &
1616
ButtonOptions & {
17-
readonly onRefreshTitle?: () => void;
17+
readonly onRefreshTitle?: () => void | Promise<void>;
1818
};
1919

2020
export class TriggerButton extends Button {

0 commit comments

Comments
 (0)