Skip to content

Commit a1e39fe

Browse files
authored
refactor(statefulProcess): makes more obvious the functions that might throw (#203)
* refactor(statefulProcess): renames `try` to `initiate` * refactor(statefulProcess): replaces `tryTo...` with `forcibly...`
1 parent f89b044 commit a1e39fe

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/library/vue/statefulProcess.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ import {
99
export const useStatefulProcess = <
1010
SomeResult,
1111
>(
12-
tryToPerformFlaggableProcess: () => Promise<SomeResult>,
12+
forciblyPerformFlaggableProcess: () => Promise<SomeResult>,
1313
): ({
14-
try: () => Promise<void>;
14+
initiate: () => Promise<void>;
1515
isInProgress: boolean;
1616
result: SomeResult | null;
1717
}) => {
1818
const flagIsRaised = ref(false);
1919

2020
const capturedResult: Ref<SomeResult | null> = ref(null);
2121

22-
const tryToPerformFlaggedProcess = async (): Promise<void> => {
22+
const forciblyPerformFlaggedProcess = async (): Promise<void> => {
2323
using cleanup = new DisposableStack();
2424
set(flagIsRaised, true);
2525

@@ -28,12 +28,12 @@ export const useStatefulProcess = <
2828
});
2929

3030
set(capturedResult, null);
31-
const resultOfProcess = await tryToPerformFlaggableProcess();
31+
const resultOfProcess = await forciblyPerformFlaggableProcess();
3232
set(capturedResult, resultOfProcess);
3333
};
3434

3535
return {
36-
try: tryToPerformFlaggedProcess,
36+
initiate: forciblyPerformFlaggedProcess,
3737
get isInProgress() {
3838
return get(flagIsRaised);
3939
},

src/pages/TextToImagePage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const imageGeneration = useStatefulProcess(async () => {
6767
<NavigationPanel>
6868
<VForm
6969
:disabled="imageGeneration.isInProgress"
70-
@submit.prevent="imageGeneration.try"
70+
@submit.prevent="imageGeneration.initiate"
7171
>
7272
<TextToImageInputSection
7373
v-model="currentPrompt"

0 commit comments

Comments
 (0)