Vue.js in Web Worker
This is a starter app of Vue.js working in Web Worker using WorkerDOM, bundled by Rollup.js. This allows Vue.js to offload its work to a background thread and send updates back to the main thread asyncronously, which should greatly increase rendering performance. See this blog post for details.
Compare these rendering performance tests: - DBMON Vue.js 2 - DBMON Vue.js 2 in Web Worker
Develop you Vue.js app as always, using
main.jsas an entry point. In
index.html, add a wrapper around
#apppointing to
main.jsand inject
worker-dom.jslibrary like this:
First run
npm installto set up the project. To build the files in
destfolder, run
npm run buildor
rollup -c. Then start the local web server e.g.
python -m http.serverand go to http://localhost:8000. Your
index.htmlpage should load
worker-dom.js, which should asynchronously fetch and load both
worker.mjsand
main.jsmodules into Web Worker.
© 2020 Jerzy Głowacki under Apache Lincese 2.0