summaryrefslogtreecommitdiff
path: root/source/features/index.tsx
diff options
context:
space:
mode:
authorGravatar yakov116 <16872793+yakov116@users.noreply.github.com> 2020-06-02 14:05:52 -0400
committerGravatar GitHub <noreply@github.com> 2020-06-02 20:05:52 +0200
commitbcbc5f702e27f6f5881c306d3b74ab617f685fac (patch)
treefeef93744744ddf4ce92a5312cec1fe5a9c356ed /source/features/index.tsx
parent9ddcd95d766d26af8fe6362c65f32370464c5bd2 (diff)
downloadrefined-github-bcbc5f702e27f6f5881c306d3b74ab617f685fac.tar.gz
refined-github-bcbc5f702e27f6f5881c306d3b74ab617f685fac.tar.zst
refined-github-bcbc5f702e27f6f5881c306d3b74ab617f685fac.zip
Meta: Change format of shortcuts map (#3163)
Diffstat (limited to 'source/features/index.tsx')
-rw-r--r--source/features/index.tsx13
1 files changed, 3 insertions, 10 deletions
diff --git a/source/features/index.tsx b/source/features/index.tsx
index 2306bc2e..ac7d79c8 100644
--- a/source/features/index.tsx
+++ b/source/features/index.tsx
@@ -14,11 +14,6 @@ type BooleanFunction = () => boolean;
type CallerFunction = (callback: VoidFunction) => void;
type FeatureInit = () => Promisable<false | void>;
-interface Shortcut {
- hotkey: string;
- description: string;
-}
-
interface FeatureMeta {
/**
If it's disabled, this should be the issue that explains why, as a reference
@@ -158,8 +153,7 @@ const setupPageLoad = async (id: FeatureID, config: InternalRunConfig): Promise<
}
};
-const shortcutMap = new Map<string, Shortcut>();
-const getShortcuts = (): Shortcut[] => [...shortcutMap.values()];
+const shortcutMap = new Map<string, string>();
const defaultPairs = new Map([
[pageDetect.hasComments, onNewComments],
@@ -202,8 +196,7 @@ const add = async (meta?: FeatureMeta, ...loaders: FeatureLoader[]): Promise<voi
// Register feature shortcuts
for (const [hotkey, description] of Object.entries(shortcuts)) {
- // TODO: change format of shortcutMap
- shortcutMap.set(hotkey, {hotkey, description});
+ shortcutMap.set(hotkey, description);
}
for (const loader of loaders) {
@@ -261,7 +254,7 @@ add(undefined, {
const features = {
add,
error: logError,
- getShortcuts
+ shortcutMap
};
export default features;