44fbc24ccd
Resolves: https://github.com/zeit/next.js/issues/12545 This PR adds an example which show how to bundle and use WebWorkers in a next.js app. The issue mentions Typescript, but adding typescript to the example should be fairly simple by following the documentation and seems out of scope for a web-worker example.
6 lines
175 B
JavaScript
6 lines
175 B
JavaScript
// This is a module worker, so we can use imports (in the browser too!)
|
|
import pi from './utils/pi'
|
|
|
|
addEventListener('message', (event) => {
|
|
postMessage(pi(event.data))
|
|
})
|