Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tomhodgins
Created October 27, 2020 20:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomhodgins/0e5a98610a1da2a98049614a4f170734 to your computer and use it in GitHub Desktop.
Save tomhodgins/0e5a98610a1da2a98049614a4f170734 to your computer and use it in GitHub Desktop.
(async () => console.log(
(await import(`data:text/javascript,export default "Is this a safe way to eval?"`)).default
))()
@tomhodgins
Copy link
Author

Okku says:

const myModule = await import(URL.createObjectURL(new Blob(
  [`
    // module code inside this template literal
  `],
  {type: "text/javascript"},
)));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment