Skip to content

Commit d032ee6

Browse files
committed
refactor: use DELAY instead of PAUSE in DelayAction
1 parent 4b8577a commit d032ee6

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/components/Main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const Main = ({
100100
}
101101
} else if (type === 'PASTE') {
102102
setCurrentIndex(prev => prev + 1);
103-
} else if (type === 'PAUSE') {
103+
} else if (type === 'DELAY') {
104104
await timeoutPromise(payload);
105105
}
106106
}

src/types/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ export type TypeTokenAction = {
55
payload: string | ReactElement;
66
};
77
export type BackspaceAction = { type: 'BACKSPACE'; payload: number };
8-
export type PauseAction = { type: 'PAUSE'; payload: number };
8+
export type DelayAction = { type: 'DELAY'; payload: number };
99
export type PasteAction = { type: 'PASTE'; payload: string | ReactElement };
10-
export type Action = TypeTokenAction | BackspaceAction | PauseAction | PasteAction;
10+
export type Action = TypeTokenAction | BackspaceAction | DelayAction | PasteAction;

src/utils/getActions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Children, isValidElement } from 'react';
44
import type {
55
Action,
66
BackspaceAction,
7-
PauseAction,
7+
DelayAction,
88
PasteAction,
99
TypeTokenAction,
1010
} from '../types/actions';
@@ -25,7 +25,7 @@ const backspace = (count: number): BackspaceAction => ({
2525
payload: count,
2626
});
2727

28-
const pause = (ms: number): PauseAction => ({ type: 'PAUSE', payload: ms });
28+
const pause = (ms: number): DelayAction => ({ type: 'DELAY', payload: ms });
2929

3030
const paste = (str: string): PasteAction => ({ type: 'PASTE', payload: str });
3131

0 commit comments

Comments
 (0)