D
D
Dimazsever2021-11-17 21:01:09
JavaScript
Dimazsever, 2021-11-17 21:01:09

How to call a function in the background script of an extension that is in another background script?

Good evening. There are two background scripts. One of them is the hls.js library. How to call a function in the first one that is in the second one(hls)? I remember exactly that I saw such a solution in one of the extensions, but lost it.

if (Hls.isSupported()) {
    var hls = new Hls();
}

An attempt to create an object generates an error: Error in event handler: ReferenceError: Hls is not defined at chrome-extension://anj ... I
specified both scripts in the manifest:
"background": {
    "scripts": ["background.js",  "hls.min.js"],
  "persistent": true
  },

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question