[RDKit_minimal.js]: Assign `initRDKitModule` to WorkerGlobalScope if possible
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, wasm
- Ambito
- web-dev
Direzione di ricerca
Start in Code/MinimalLib and trace how RDKit_minimal.js is generated from the C++ source. Check the generated module-worker behavior when RDKit_minimal.js is imported with type: "module". Done means initRDKitModule is available through WorkerGlobalScope without importScripts.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
We can only use RDKit.js inside a web worker in a legacy way:
// worker.js, a classic worker
importScripts("./RDKit_minimal.js")
initRDKitModule().then((rdkit) => {
const mol = rdkit.get_mol(smiles)
...
postMessage(...)
})
// use this classic worker file
const worker = new Worker("./worker.js")
While there is a preferred way to use web worker: use module type:
const worker = new Worker("./worker.js", { type: "module" })
In this way, we can't use importScripts anymore since now worker.js file is considered a module, and an error would occur:
So, I instead we should use import:
// worker.js, a module worker
import './RDKit_minimal.js'
// ...
Now here's the problem: I can't access the initRDKitModule function anymore since it didn't assigned to WorkerGlobalScope, so we can't directly do something like below, which I think would be an ideal way to use RDKit.js:
import './RDKit_minimal.js'
initRDKitModule() // uncaught ReferenceError: initRDKitModule is not defined
Describe the solution you'd like
initRDKitModule function should be assigned to WorkerGlobalScope in RDKit_minimal.js.
I tried and it seems to work by just adding these lines at the end of RDKit_minimal.js:
I think it should be added directly in the source code before JavaScript code generation, I don't know how to do it since it's written in c++.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
- Lingua principale
- SCSS
- Stelle
- 251
- Fork
- 47
- Merge medio
- 4m
- PR unite (30g)
- 4
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rdkit/rdkit-js
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
-
Expose a method to generate a scaffold from SMILESForse di nuovo libera @winshaurya l’ha presa 276 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
Tutte le issue di rdkit/rdkit-js
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
bherbruck/solvecraft#2167 ·
-
bug priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
brentspine/brents-toasts#143 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
bigskysoftware/htmx#4147 ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Wavvon/Wavvon-clients#135 ·
I maintainer di solito rispondono entro 1 giorno