mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-03 06:12:07 -07:00
feat(core): add Electron runtime, services, and app composition
This commit is contained in:
60
src/main/runtime/global-shortcuts-runtime-handlers.ts
Normal file
60
src/main/runtime/global-shortcuts-runtime-handlers.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import type { ConfiguredShortcuts } from '../../core/utils/shortcut-config';
|
||||
import {
|
||||
createGetConfiguredShortcutsHandler,
|
||||
createRefreshGlobalAndOverlayShortcutsHandler,
|
||||
createRegisterGlobalShortcutsHandler,
|
||||
} from './global-shortcuts';
|
||||
import {
|
||||
createBuildGetConfiguredShortcutsMainDepsHandler,
|
||||
createBuildRefreshGlobalAndOverlayShortcutsMainDepsHandler,
|
||||
createBuildRegisterGlobalShortcutsMainDepsHandler,
|
||||
} from './global-shortcuts-main-deps';
|
||||
|
||||
type GetConfiguredShortcutsMainDeps = Parameters<
|
||||
typeof createBuildGetConfiguredShortcutsMainDepsHandler
|
||||
>[0];
|
||||
type RegisterGlobalShortcutsMainDeps = Parameters<
|
||||
typeof createBuildRegisterGlobalShortcutsMainDepsHandler
|
||||
>[0];
|
||||
type RefreshGlobalAndOverlayShortcutsMainDeps = Parameters<
|
||||
typeof createBuildRefreshGlobalAndOverlayShortcutsMainDepsHandler
|
||||
>[0];
|
||||
|
||||
export function createGlobalShortcutsRuntimeHandlers(deps: {
|
||||
getConfiguredShortcutsMainDeps: GetConfiguredShortcutsMainDeps;
|
||||
buildRegisterGlobalShortcutsMainDeps: (
|
||||
getConfiguredShortcuts: () => ConfiguredShortcuts,
|
||||
) => RegisterGlobalShortcutsMainDeps;
|
||||
buildRefreshGlobalAndOverlayShortcutsMainDeps: (
|
||||
registerGlobalShortcuts: () => void,
|
||||
) => RefreshGlobalAndOverlayShortcutsMainDeps;
|
||||
}) {
|
||||
const getConfiguredShortcutsMainDeps = createBuildGetConfiguredShortcutsMainDepsHandler(
|
||||
deps.getConfiguredShortcutsMainDeps,
|
||||
)();
|
||||
const getConfiguredShortcutsHandler =
|
||||
createGetConfiguredShortcutsHandler(getConfiguredShortcutsMainDeps);
|
||||
const getConfiguredShortcuts = () => getConfiguredShortcutsHandler();
|
||||
|
||||
const registerGlobalShortcutsMainDeps = createBuildRegisterGlobalShortcutsMainDepsHandler(
|
||||
deps.buildRegisterGlobalShortcutsMainDeps(getConfiguredShortcuts),
|
||||
)();
|
||||
const registerGlobalShortcutsHandler =
|
||||
createRegisterGlobalShortcutsHandler(registerGlobalShortcutsMainDeps);
|
||||
const registerGlobalShortcuts = () => registerGlobalShortcutsHandler();
|
||||
|
||||
const refreshGlobalAndOverlayShortcutsMainDeps =
|
||||
createBuildRefreshGlobalAndOverlayShortcutsMainDepsHandler(
|
||||
deps.buildRefreshGlobalAndOverlayShortcutsMainDeps(registerGlobalShortcuts),
|
||||
)();
|
||||
const refreshGlobalAndOverlayShortcutsHandler = createRefreshGlobalAndOverlayShortcutsHandler(
|
||||
refreshGlobalAndOverlayShortcutsMainDeps,
|
||||
);
|
||||
const refreshGlobalAndOverlayShortcuts = () => refreshGlobalAndOverlayShortcutsHandler();
|
||||
|
||||
return {
|
||||
getConfiguredShortcuts,
|
||||
registerGlobalShortcuts,
|
||||
refreshGlobalAndOverlayShortcuts,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user