From a96a2e7e005201cd9dbfdc5ea5eef9bf7bd9f9a1 Mon Sep 17 00:00:00 2001 From: Glen Chiacchieri Date: Fri, 26 Feb 2021 18:45:43 -0500 Subject: [PATCH] fixes error when running ExtPay in content script fixes #4. there is no browser.runtime.onInstalled in content scripts --- ExtPay.dev.js | 2 +- dist/ExtPay.common.js | 2 +- dist/ExtPay.js | 2 +- dist/ExtPay.module.js | 2 +- package.json | 2 +- sample-extension/ExtPay.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ExtPay.dev.js b/ExtPay.dev.js index ce12ac8..5075c30 100644 --- a/ExtPay.dev.js +++ b/ExtPay.dev.js @@ -36,7 +36,7 @@ export default function ExtPay(extension_id) { } } - browser.runtime.onInstalled.addListener(async function(install_details) { + browser.runtime.onInstalled && browser.runtime.onInstalled.addListener(async function(install_details) { const ext_info = await browser.management.getSelf() if (ext_info.installType == 'development') { diff --git a/dist/ExtPay.common.js b/dist/ExtPay.common.js index 68decd4..21af40b 100644 --- a/dist/ExtPay.common.js +++ b/dist/ExtPay.common.js @@ -36,7 +36,7 @@ function ExtPay(extension_id) { } } - browser.runtime.onInstalled.addListener(async function(install_details) { + browser.runtime.onInstalled && browser.runtime.onInstalled.addListener(async function(install_details) { const ext_info = await browser.management.getSelf(); if (ext_info.installType == 'development') { diff --git a/dist/ExtPay.js b/dist/ExtPay.js index d23204a..4fce46e 100644 --- a/dist/ExtPay.js +++ b/dist/ExtPay.js @@ -1265,7 +1265,7 @@ var ExtPay = (function () { } } - browserPolyfill.runtime.onInstalled.addListener(async function(install_details) { + browserPolyfill.runtime.onInstalled && browserPolyfill.runtime.onInstalled.addListener(async function(install_details) { const ext_info = await browserPolyfill.management.getSelf(); if (ext_info.installType == 'development') { diff --git a/dist/ExtPay.module.js b/dist/ExtPay.module.js index 4bad229..832fa66 100644 --- a/dist/ExtPay.module.js +++ b/dist/ExtPay.module.js @@ -34,7 +34,7 @@ function ExtPay(extension_id) { } } - runtime.onInstalled.addListener(async function(install_details) { + runtime.onInstalled && runtime.onInstalled.addListener(async function(install_details) { const ext_info = await management.getSelf(); if (ext_info.installType == 'development') { diff --git a/package.json b/package.json index 7cda60a..1a442d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "extpay", - "version": "2.0.1", + "version": "2.0.2", "description": "The JavaScript library for https://extensionpay.com - payments for browser extensions, no server needed.", "main": "./dist/ExtPay.common.js", "module": "./dist/ExtPay.module.js", diff --git a/sample-extension/ExtPay.js b/sample-extension/ExtPay.js index d23204a..4fce46e 100644 --- a/sample-extension/ExtPay.js +++ b/sample-extension/ExtPay.js @@ -1265,7 +1265,7 @@ var ExtPay = (function () { } } - browserPolyfill.runtime.onInstalled.addListener(async function(install_details) { + browserPolyfill.runtime.onInstalled && browserPolyfill.runtime.onInstalled.addListener(async function(install_details) { const ext_info = await browserPolyfill.management.getSelf(); if (ext_info.installType == 'development') {