feat: add Firefox support with cross-browser compatibility
Add manifest.firefox.json for Firefox MV3 (gecko ID, background scripts instead of service_worker, options_ui). Introduce browser-polyfill.js shim so all modules use whichever API is available (browser.* or chrome.*). Add build.sh to target chrome, firefox, or both. https://claude.ai/code/session_01Dvgwe7XMoSxnWXkih8p1Cw
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Minimal browser API compatibility layer.
|
||||
*
|
||||
* Firefox exposes `browser.*` (Promise-based) and polyfills `chrome.*`.
|
||||
* Chrome only has `chrome.*` (callback-based, but storage/runtime are
|
||||
* Promise-based in MV3). This normalizes to whichever is available.
|
||||
*/
|
||||
|
||||
const api =
|
||||
typeof browser !== 'undefined' && browser.runtime
|
||||
? browser
|
||||
: typeof chrome !== 'undefined'
|
||||
? chrome
|
||||
: null;
|
||||
|
||||
if (!api) {
|
||||
console.error('[Silent Send] No WebExtension API found');
|
||||
}
|
||||
|
||||
export default api;
|
||||
Reference in New Issue
Block a user