mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-28 18:22:42 -08:00
feat(core): add Electron runtime, services, and app composition
This commit is contained in:
31
src/main/runtime/numeric-shortcut-session-handlers.ts
Normal file
31
src/main/runtime/numeric-shortcut-session-handlers.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import type {
|
||||
NumericShortcutSessionMessages,
|
||||
NumericShortcutSessionStartParams,
|
||||
} from '../../core/services/numeric-shortcut';
|
||||
|
||||
type NumericShortcutSessionLike = {
|
||||
start: (params: NumericShortcutSessionStartParams) => void;
|
||||
cancel: () => void;
|
||||
};
|
||||
|
||||
export function createCancelNumericShortcutSessionHandler(deps: {
|
||||
session: NumericShortcutSessionLike;
|
||||
}) {
|
||||
return (): void => {
|
||||
deps.session.cancel();
|
||||
};
|
||||
}
|
||||
|
||||
export function createStartNumericShortcutSessionHandler(deps: {
|
||||
session: NumericShortcutSessionLike;
|
||||
onDigit: (digit: number) => void;
|
||||
messages: NumericShortcutSessionMessages;
|
||||
}) {
|
||||
return (timeoutMs: number): void => {
|
||||
deps.session.start({
|
||||
timeoutMs,
|
||||
onDigit: deps.onDigit,
|
||||
messages: deps.messages,
|
||||
});
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user