Code Monkey home page Code Monkey logo

vue-in-web-worker's Introduction

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 asynchronously, which should greatly increase rendering performance. See this blog post for details.

Benchmarks

Compare these rendering performance tests:

Developing

Develop you Vue.js app as always, using main.js as an entry point. In index.html, add a wrapper around #app pointing to main.js and inject worker-dom.js library like this:

<main src="dist/main.js">
  <div id="app"></div>
</main>
<script src="dist/worker-dom.js"></script>

Building

First run npm install to set up the project. To build the files in dest folder, run npm run build or rollup -c. Then start the local web server e.g. python -m http.server and go to http://localhost:8000. Your index.html page should load worker-dom.js, which should asynchronously fetch and load both worker.mjs and main.js modules into Web Worker.

License

© 2021 Jerzy Głowacki under Apache Lincese 2.0

vue-in-web-worker's People

Contributors

niutech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-in-web-worker's Issues

Vue router

Is there any way to get this to play nice with vue router?
The web worker doesn't seem to have access to document.location.href

Sadly not much use without it

Error thrown in

document.location.href.replace(document.location.hash,"")

It seems to be a polyfill from document.currentScript which is itself bundled because of the vue util setPublicPath

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.