Skip to content

Commit

Permalink
refactor: make startup-handler non-async
Browse files Browse the repository at this point in the history
These functions are non async anyways, hence there is no need to make
them async. By that, we also can use them directly in the handler
instead of wrapping in a lambda.

Signed-off-by: Felix Moessbauer <[email protected]>
  • Loading branch information
fmoessbauer committed Jul 2, 2024
1 parent cdcac17 commit b89ed7e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ async function on_message(response) {
}
}

async function on_startup() {
ssoLog('start linux-entra-sso');
function on_startup() {
if (initialized) {
ssoLog('linux-entra-sso already initialized');
return;
Expand Down Expand Up @@ -250,7 +249,7 @@ async function on_startup() {
["blocking", "requestHeaders"]
);
} else {
await chrome.alarms.create('prt-sso-refresh', {
chrome.alarms.create('prt-sso-refresh', {
periodInMinutes: CHROME_PRT_SSO_REFRESH_INTERVAL_MIN
});
chrome.alarms.onAlarm.addListener((alarm) => {
Expand All @@ -271,8 +270,7 @@ async function on_startup() {
initialized = true;
}

chrome.runtime.onStartup.addListener(() => {
on_startup();
});
// use this API to prevent the extension from being disabled
chrome.runtime.onStartup.addListener(on_startup);

on_startup();

0 comments on commit b89ed7e

Please sign in to comment.