Uncaught ReferenceError: ExtPay is not defined on popup.js #156
Closed
Johnek1989
started this conversation in
General
Replies: 2 comments
-
popup.js is workig I forgot to add "ExtPay.js" to popup.html Now i have same issue on content script: const extpay = ExtPay('agenthelpertest'); extpay.getUser().then((user) => { |
Beta Was this translation helpful? Give feedback.
0 replies
-
Solved again the issue was that is manifest.json file I mess up order: "js": [ "content.js","ExtPay.js"] insdeat of "js": ["ExtPay.js", "content.js"], |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I am trying to use ExtPay function outside background.js I getting errors like above. I found:
// background.js
importScripts('ExtPay.js') // or
import
/require
if using a bundlervar extpay = ExtPay('sample-extension'); // Careful! See note below
extpay.startBackground();
Note about service workers: In the example above extpay will become undefined when accessed in service worker callbacks. To use extpay in service worker callbacks, redeclare it like so:
chrome.storage.local.get('foo', function() {
var extpay = ExtPay('sample-extension');
// ...
})
but i have no idea how to implement bottom part of code.
Beta Was this translation helpful? Give feedback.
All reactions