Skip to content

Commit 2b501e9

Browse files
committed
chore: add debug flag
1 parent 353e79e commit 2b501e9

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.0.4",
2+
"version": "1.0.5",
33
"license": "MIT",
44
"main": "dist/index.js",
55
"typings": "dist/index.d.ts",

src/context/KeyBindContext.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const KeyBindContext = createContext({} as KeyBindContextState);
1919
const KeyBindProvider: FC<KeyBindProviderPropsI> = ({
2020
children,
2121
shortcuts = [],
22+
debug = false,
2223
}) => {
2324
const [storeShortcuts, setStoreCommands] = useState(shortcuts);
2425

@@ -28,7 +29,7 @@ const KeyBindProvider: FC<KeyBindProviderPropsI> = ({
2829
return [
2930
...(prev?.filter(s => {
3031
const isDuplicated = isDuplicate(prev, s);
31-
if (isDuplicated) {
32+
if (isDuplicated && debug) {
3233
console.warn(logMsg(s, shortcut));
3334
}
3435
return !isDuplicated;

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { PlatformType } from './platform.type';
44
export interface KeyBindProviderPropsI {
55
children?: React.ReactNode;
66
shortcuts?: ShortcutType[];
7+
debug?: boolean;
78
}
89

910
export type KeysType = {

0 commit comments

Comments
 (0)