Skip to content

Migrate to promise based APIs after MV3 is landed #2155

Open
@melink14

Description

@melink14

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Code healthIssues which if fixed would improve the health of the project (as opposed to new features/bugs)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions