MCPcopy
hub / github.com/VOICEVOX/voicevox / createUILockAction

Function createUILockAction

src/store/ui.ts:32–53  ·  view source on GitHub ↗
(
  action: (
    context: DotNotationActionContext<
      S,
      S,
      AllGetters,
      AllActions,
      AllMutations
    >,
    payload: Parameters<A[K]>[0],
  ) => ReturnType<A[K]> extends Promise<unknown>
    ? ReturnType<A[K]>
    : Promise<ReturnType<A[K]>>,
)

Source from the content-addressed store, hash-verified

30import { objectEntries } from "@/helpers/typedEntries";
31
32export function createUILockAction<S, A extends ActionsBase, K extends keyof A>(
33 action: (
34 context: DotNotationActionContext<
35 S,
36 S,
37 AllGetters,
38 AllActions,
39 AllMutations
40 >,
41 payload: Parameters<A[K]>[0],
42 ) => ReturnType<A[K]> extends Promise<unknown>
43 ? ReturnType<A[K]>
44 : Promise<ReturnType<A[K]>>,
45): DotNotationAction<S, S, A, K, AllGetters, AllActions, AllMutations> {
46 return (context, payload: Parameters<A[K]>[0]) => {
47 context.mutations.LOCK_UI();
48 // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
49 return action(context, payload).finally(() => {
50 context.mutations.UNLOCK_UI();
51 });
52 };
53}
54
55export function withProgress<T>(
56 action: Promise<T>,

Callers 6

singing.tsFile · 0.90
setting.tsFile · 0.90
audio.tsFile · 0.90
engine.tsFile · 0.90
index.tsFile · 0.90
ui.tsFile · 0.85

Calls 1

actionFunction · 0.70

Tested by

no test coverage detected