diff --git a/extension/index-manager.js b/extension/index-manager.js index 5fa286f..b784be6 100644 --- a/extension/index-manager.js +++ b/extension/index-manager.js @@ -84,11 +84,11 @@ class IndexManager { storage.setItem('index-rustc', index); } - static async getTargetsIndex() { + static async getTargetIndex() { return await storage.getItem('index-target') || targetsIndex; } - static setTargetsIndex(index) { + static setTargetIndex(index) { storage.setItem('index-target', index); } diff --git a/extension/main.js b/extension/main.js index 27486c3..b8fe7b0 100644 --- a/extension/main.js +++ b/extension/main.js @@ -39,7 +39,7 @@ function getPlatformOs() { let labelCommand = new LabelCommand(await IndexManager.getLabelIndex()); let rfcCommand = new RfcCommand(await IndexManager.getRfcIndex()); let rustcCommand = new RustcCommand(await IndexManager.getRustcIndex()); - let targetCommand = new TargetCommand(await IndexManager.getTargetsIndex()); + let targetCommand = new TargetCommand(await IndexManager.getTargetIndex()); const cargoCommand = new SimpleCommand('cargo', 'Search useful third-party cargo subcommands.', commandIndex['cargo']); const bookCommand = new SimpleCommand('book', 'Search Rust books.', commandIndex['book']); const bookZhCommand = new SimpleCommand('book/zh', 'Search Chinese Rust books.', commandIndex['book/zh']); diff --git a/extension/script/rust-extension-sh.js b/extension/script/rust-extension-sh.js index e77155c..5878903 100644 --- a/extension/script/rust-extension-sh.js +++ b/extension/script/rust-extension-sh.js @@ -6,7 +6,7 @@ window.addEventListener("message", async function (event) { console.log('target:', message.target); switch (message.target) { case 'book': { - await IndexManager.setBookIndex(message.index); + IndexManager.setBookIndex(message.index); break; } case 'caniuse': { @@ -39,7 +39,7 @@ window.addEventListener("message", async function (event) { break; } case 'target': { - IndexManager.setTargetsIndex(message.index); + IndexManager.setTargetIndex(message.index); break; } }