Web Worker API implemented as Vue.js composition functions
🏠 Homepage
# install with yarn
yarn add @vue/composition-api vue-use-worker
# install with npm
npm install @vue/composition-api vue-use-worker
<template>
<button @click="runReduce()">run reduce</button>
</template>
<script>
import useWorker from 'vue-use-worker';
export default {
setup() {
const reduce = array => array.reduce((acc, cur) => (acc * cur) / cur - Math.random(), 1);
const [workerReduce] = useWorker(reduce);
const numbers = [...Array(9000000)].map(() => Math.floor(Math.random() * 1000000));
return { workerReduce, numbers };
},
methods: {
async runReduce() {
await this.workerReduce(this.numbers);
}
}
};
</script>
👤 Tarek Touati
- Twitter: @tarektweeti
- Github: @Tarektouati
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
This library is inspired by useWorker for React.
This README was generated with ❤️ by readme-md-generator