How can I restrict the scope of setInterval
to a specific component only in Quasar framework when using SPA mode?
Setting the function causes it to run everywhere, even when the page's URL is changed. I have already checked a similar question on Stack Overflow, but it did not provide the solution I was looking for.
Here is a snippet of my code:
methods:
testInterval: function () {
setInterval(() => this.playCMD(), 2000)
},
playCMD: function () {
// Do something
console.log('Do something')
}
I am looking for a way to confine the execution of a function in VueJs to a specific scope, rather than having it run throughout the entire application when using SPA mode.