Inject script into Worker

2

Hello, I have the following javascript class

class MinhaClasse {
    static list() {
        return fetch('/api/endPoint', {
            method: 'GET', 
            headers: {
                'Authorization': Auth.getBasic()
            }
        })
    } 
}

When inside the web worker I call MinhaClasse it is undefined! how can I inject it into the worker?

    
asked by anonymous 25.11.2016 / 12:27

1 answer

0

To import the class just use the function self.importScripts

Source: link

Example:

self.importScripts('/minhaClasse.js')
    
25.11.2016 / 14:23