Skip to content

Cannot start TeaVM-compiled JavaScript code from Web Worker using eval() #731

Closed Answered by konsoletyper
WorldEditAxe asked this question in Q&A
Discussion options

You must be logged in to vote

Instead of eval, did you try using importScript? As for your code, eval creates a separate scope, and main is defined there, not in the scope that actually calls main. With eval-based approach it would look something like that:

fetch('%s').then(response=>response.text().then(script=>{globalThis.eval(script + ";main();");}))

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by WorldEditAxe
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants