summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/features/improve-shortcut-help.tsx2
-rw-r--r--source/features/index.tsx13
2 files changed, 4 insertions, 11 deletions
diff --git a/source/features/improve-shortcut-help.tsx b/source/features/improve-shortcut-help.tsx
index b63ac31f..607fe341 100644
--- a/source/features/improve-shortcut-help.tsx
+++ b/source/features/improve-shortcut-help.tsx
@@ -16,7 +16,7 @@ function improveShortcutHelp(dialog: Element): void {
</div>
<ul>
- {features.getShortcuts().map(({hotkey, description}) => (
+ {[...features.shortcutMap].map(([hotkey, description]) => (
<li className="Box-row d-flex flex-row">
<div className="flex-auto">{description}</div>
<div className="ml-2 no-wrap">
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;