function importWorklet(worklet, code) {
    let url;
    if (typeof code === 'object') {
      url = code.url;
    } else {
      const blob = new Blob([code], {type: 'text/javascript'});
      url = URL.createObjectURL(blob);
    }

    return worklet.addModule(url);
}
Imports code into a worklet. E.g.

importWorklet(CSS.paintWorklet, {url: 'script.js'});
importWorklet(CSS.paintWorklet, '(javascript string)');

@param {Worklet} worklet
@param {(Object|string)} code