处理service worker的问题
Some checks failed
test / Run tests (push) Failing after 3s
build / Build (push) Failing after 6s
Some checks failed
test / Run tests (push) Failing after 3s
build / Build (push) Failing after 6s
This commit is contained in:
@ -217,3 +217,13 @@ export function sleep(time: number) {
|
||||
setTimeout(resolve, time);
|
||||
});
|
||||
}
|
||||
|
||||
// 使service_worker长时间存活
|
||||
export async function waitUntil(promise: Promise<any>) {
|
||||
const keepAlive = setInterval(chrome.runtime.getPlatformInfo, 25 * 1000);
|
||||
try {
|
||||
await promise;
|
||||
} finally {
|
||||
clearInterval(keepAlive);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user