Files
wxt/src/client/utils/keepServiceWorkerAlive.ts
T

12 lines
314 B
TypeScript

import browser from 'webextension-polyfill';
/**
* https://developer.chrome.com/blog/longer-esw-lifetimes/
*/
export function keepServiceWorkerAlive() {
setInterval(async () => {
// Calling an async browser API resets the service worker's timeout
await browser.runtime.getPlatformInfo();
}, 5e3);
}