Skip to content

Running js code from Pyodide WebWorker #7810

@bevilacqc

Description

@bevilacqc

Feature

Would it possible to include some custom js code in the webworker created by panel convert --to pyodide-worker?

What I already tried

I tried to include js code through pn.extension(js_files=js_file) but, from the browser console, I see that the code is running in the main thread and not in the worker. Same problem when I tried to include the js code as part of a JSComponent.

Additional background

I would like to mount a file opened through an HTML file input field in the Pyodide WORKERFS filesystem. That gives me the possibility of reading large files without loading them in memory or making a copy while running the panel app in WASM. In order to do that I have to access the pyodide.FS object which is defined in the worker.
I know that this approach is working if I just paste the js code into the script generated by panel convert, but I was wondering if there is any better/more automatic approach.
Alternatively I would be happy to know if there is another solution to this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions