gautamkrishnar / motrix-webextension

A browser extension for the Motrix Download Manager
GNU General Public License v3.0
1.21k stars 97 forks source link

fix: service worker is not always alive #119

Closed CW-B-W closed 1 year ago

CW-B-W commented 1 year ago

Issue

As @gautamkrishnar mentioned in https://github.com/gautamkrishnar/motrix-webextension/issues/118#issuecomment-1512069338

For manifest v3 extensions, the service worker won't always stay alive so the extension need to be converted to more of an event-driven approach

Description

This PR aims to resolve this issue with the Offscreen API. The solution referenced from Persistent Service Worker in Chrome Extension.

Result

The service worker is still alive after the extension was turned on for hours, and can still send tasks to Motrix succesfully.

gautamkrishnar commented 1 year ago

@CW-B-W Great implementation. thanks for working on this.