Popup is now calling the browser storage directly instead of using the messaging system. Should be a bit faster.

This commit is contained in:
Ryan Breen
2023-01-27 17:30:10 -05:00
parent b0faf6146e
commit 621e8b358b
2 changed files with 31 additions and 17 deletions

View File

@@ -1,6 +1,22 @@
const storage = browser.storage.local;
export async function bglog(msg, module = null) {
await browser.runtime.sendMessage({
kind: 'log',
payload: { msg, module },
});
}
export async function getProfileNames() {
let profiles = await storage.get({ profiles: [] });
return profiles.profiles.map(p => p.name);
}
export async function getProfileIndex() {
const index = await storage.get({ profileIndex: 0 });
return index.profileIndex;
}
export async function setProfileIndex(profileIndex) {
await storage.set({ profileIndex });
}