Skip to content

Commit

Permalink
Merge pull request lingua-libre#99 from kabir-afk/refactor/callbacks-…
Browse files Browse the repository at this point in the history
…to-promises

Refactor/callbacks to promises
  • Loading branch information
hugolpz authored Jun 20, 2024
2 parents e6882bb + 8d5f2f8 commit 2338fd3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ var browser = (browserType === 'firefox') ? browser : (browserType === 'chrome')
if (browserType === "chrome") {
// Use Chrome Extensions API,
async function getBackgroundPage() {
return new Promise((resolve) => {
chrome.runtime.sendMessage({ command: "getBackground" }, (response) => {
resolve(response);
});
return new Promise(async(resolve) => {
let response = await chrome.runtime.sendMessage({ command: "getBackground" });
resolve(response);
});
}
_backgroundPage = await getBackgroundPage();
Expand Down

0 comments on commit 2338fd3

Please sign in to comment.