Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
Last active June 13, 2018 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nolanlawson/2c5514ee00d5deb07ddc0b91b4a6b549 to your computer and use it in GitHub Desktop.
Save nolanlawson/2c5514ee00d5deb07ddc0b91b4a6b549 to your computer and use it in GitHub Desktop.
Test fetch within worker
<!doctype html>
<html lang="en">
<head>
<title>Test prefetch in worker</title>
</head>
<body>
<h1>Test prefetch in worker</h1>
</body>
<script>
var worker = new Worker('worker.js')
</script>
</html>
console.log("tada")
fetch('library.js').then(() => {
console.log('fetched library with fetch(), waiting 5 secods to importScripts()')
setTimeout(() => {
importScripts('library.js')
}, 5000)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment