Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to promise based APIs after MV3 is landed #2155

Open
melink14 opened this issue Aug 18, 2024 · 0 comments
Open

Migrate to promise based APIs after MV3 is landed #2155

melink14 opened this issue Aug 18, 2024 · 0 comments
Labels
Code health Issues which if fixed would improve the health of the project (as opposed to new features/bugs)

Comments

@melink14
Copy link
Owner

Except for event listeners most APIs that used callbacks before now support Promise return values. We should migrate to those.

In some cases, we've even created wrappers to transform the callback based code into promise based code.

// Simply wrapper which makes `sync.get` `Promise` based.
async function getStorage(): Promise<MutableConfig> {
const config = await new Promise<MutableConfig>((resolve) => {
chrome.storage.sync.get(defaultConfig, (cloudStorage) => {
resolve(cloudStorage as MutableConfig);
});
});
return config;
}

@melink14 melink14 added the Code health Issues which if fixed would improve the health of the project (as opposed to new features/bugs) label Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code health Issues which if fixed would improve the health of the project (as opposed to new features/bugs)
Projects
None yet
Development

No branches or pull requests

1 participant