How can we use data and methods in vue-worker ?
See original GitHub issueI have read this
It is not possible to pass as an arg this from a Vue Component. You can pass this.$data or any variable within data or computed
but no idea how to access data and methods insight worker ?
export default {
components: {
Attribute,
vueCustomScrollbar,
Time
},
data() {
return {
user : {},
}
},
computed:{
reversedMessage: function () {
return 100000;
}
},
mounted() {
// how to use vue worker to access
this.$worker.run(this.userDetails()); // not working
this.$worker.run((arg1) => `this.$worker run 2: ${arg1}`, [this.$reversedMessage]). // not working
this.$worker.run((arg1) => `this.$worker run 2: ${arg1}`, [this.$data.user]). // working
},
methods: {
userDetails(){
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
1. data and methods in Vuejs. Vue.js is a javascript ... - Medium
It's a function, which usually stores variables. methods: It's a type of function in the vue app, as we used to store every...
Read more >Vue.js data() | How data() Works in vue.js with Examples
js data() method to the user. Basically in vue.js data() we defined collection of logic and stored in component using vue.js we can...
Read more >What is Vue way to access to data from methods?
Inside methods if you don't have another scope defined inside, you can access your data like that: this.sendButtonDisable = true;.
Read more >How to use web workers in Vue applications - Educative.io
Data is passed between the worker and the main thread via messages — the main thread and worker thread send messages using the...
Read more >Use Web Workers with Ease in Vue.js with vue-worker
The core premise of vue-worker (or rather, simple-web-worker by the same author) is that Web Workers can be initialized from a Data URI,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You could do something in data like this -
data() { return { w: function () { return “this.$worker run 1: Function in other thread”; }, }; },
And then use in worker like this -
this.$worker .run(this.worker1()) .then(console.log) // logs ‘this.$worker run 1: Function in other thread’ .catch(console.error); // logs any possible error
@israelss would you please give some advice