Replies: 4 comments 1 reply
-
I think this should be workable, modelling this after the node environment where duckdb-wasm is executed directly in the main thread, but there is some refactoring needed to match functionality. The specific problem you are tackling might be significantly simpler if you know what's a minimal set of functionality you would need you can try embed directly duckdb-browser-eh.js and then build the API you need to access the lower level functions. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply! Where might I be able to find the node environment example showing how duckdb-wasm can be used directly in the main thread? The Node examples in the |
Beta Was this translation helpful? Give feedback.
-
I am also trying to run @sswatson and @carlopi were either of you able to find or create an example using |
Beta Was this translation helpful? Give feedback.
-
Using an offscreen document can serve as a pseudo-worker from a service worker. You can also open a web worker from an offscreen document. Offscreen documents are more persistent than service workers, making them a viable alternative. I personally have not had one terminate prematurely yet. That said, dedicated workers from service workers are expected to be added to the web (and thus extensions) soon, which could provide a more native solution. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm looking to use DuckDB in a Chrome extension, and it works great if I load DuckDB WASM in the bundle for the extension popup. However, the popup environment is transient, so that approach involves a lot of serialization and deserialization. So it would be much nicer if I could move the DuckDB execution into the background script.
On the other hand, the background script in a Chrome extension doesn't have access to the Worker API, so I can't do
const worker = new Worker(bundle.mainWorker); db = new duckdb.AsyncDuckDB(logger, worker);
as one usually does in the instantiation boilerplate in the README.So my question is: is it possible to use DuckDB WASM in an environment where you don't have access to the
Worker
class?Beta Was this translation helpful? Give feedback.
All reactions