*Remove chrome.runtime check and namespace the package
This commit is contained in:
parent
f818ecbac3
commit
1f7f73c23b
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"name": "webextension-polyfill",
|
||||
"name": "@lumeweb/webextension-polyfill",
|
||||
"version": "0.8.0",
|
||||
"description": "A lightweight polyfill library for Promise-based WebExtension APIs in Chrome.",
|
||||
"main": "dist/browser-polyfill.js",
|
||||
"main": "src/browser-polyfill.js",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
|
|
|
@ -6,10 +6,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
if (typeof globalThis != "object" || typeof chrome != "object" || !chrome || !chrome.runtime || !chrome.runtime.id) {
|
||||
throw new Error("This script should only be loaded in a browser extension.");
|
||||
}
|
||||
|
||||
if (typeof globalThis.browser === "undefined" || Object.getPrototypeOf(globalThis.browser) !== Object.prototype) {
|
||||
const CHROME_SEND_MESSAGE_CALLBACK_NO_RESPONSE_MESSAGE = "The message port closed before a response was received.";
|
||||
const SEND_RESPONSE_DEPRECATION_WARNING = "Returning a Promise is the preferred way to send a reply from an onMessage/onMessageExternal listener, as the sendResponse will be removed from the specs (See https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessage)";
|
||||
|
|
Loading…
Reference in New Issue