Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for importScripts() #2

Open
developit opened this issue Apr 10, 2020 · 3 comments · May be fixed by #9
Open

Add support for importScripts() #2

developit opened this issue Apr 10, 2020 · 3 comments · May be fixed by #9
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@developit
Copy link
Owner

The implementation could be relatively simple:

const vm = require('vm');
const fs = require('fs');
function importScripts() {
  for (var i=0; i<arguments.length; i++) {
    var url = arguments[i];
    vm.runInThisContext(fs.readFileSync(url,'utf-8')),{ filename: url });
  }
}
@developit developit changed the title Feature: importScripts() Add support for importScripts() Apr 10, 2020
@developit developit added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Apr 10, 2020
@metcoder95
Copy link

Hi! I would like to help, but is that all the context or really is so easy as the example?

@developit
Copy link
Owner Author

@metcoder95 it should really just be that easy! We will just want to make sure this is only enabled when the Worker is instantiated without {type:'module'}.

@metcoder95 metcoder95 linked a pull request May 8, 2020 that will close this issue
@AmitMY
Copy link

AmitMY commented Aug 13, 2022

Hi @developit
Any chance of having this merged/fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants