Skip to content

Commit

Permalink
Merge pull request #82 from underctrl-io/twlite-patch-1
Browse files Browse the repository at this point in the history
feat(ButtonKit): add end reason to onEnd
  • Loading branch information
notunderctrl authored Dec 16, 2024
2 parents 29b4a0e + 5e6b0c2 commit 1ac2f35
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/commandkit/src/components/ButtonKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type CommandKitButtonBuilderInteractionCollectorDispatch = (
interaction: ButtonInteraction,
) => Awaitable<void>;

export type CommandKitButtonBuilderOnEnd = () => Awaitable<void>;
export type CommandKitButtonBuilderOnEnd = (reason: string) => Awaitable<void>;

export type CommandKitButtonBuilderInteractionCollectorDispatchContextData = {
/**
Expand Down Expand Up @@ -156,15 +156,15 @@ export class ButtonKit extends ButtonBuilder {
return handler(interaction);
});

this.#collector.on('end', () => {
this.#collector.on('end', (_, reason) => {
this.#destroyCollector();
this.#onEndHandler?.();
this.#onEndHandler?.(reason);
});
}

public dispose() {
this.#destroyCollector();
this.#onEndHandler?.();
this.#onEndHandler?.('disposed');
return this;
}

Expand Down

0 comments on commit 1ac2f35

Please sign in to comment.