Rename target methods

This commit is contained in:
Folyd 2022-11-09 22:39:03 +08:00
parent 3cb8eb5775
commit 64850e4d1b
3 changed files with 5 additions and 5 deletions

View file

@ -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);
}

View file

@ -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']);

View file

@ -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;
}
}