Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
And if you need to access the component instance inside the throttled function, then simply dont use an arrow function:
data: () => ({ stuff }),
methods: {
throttledMethod: _.throttle(function() {
console.log(`I get fired every two seconds! and have access to this.stuff !`)
}, 2000)
}
If you only need the debounce function, you can import it by itself:
import { debounce } from 'lodash'
Linus Borg, a core member of the Vuejs team, recommends creating debounced methods in created() [1], to avoid wonky behavior across instances.
In this case, it would look like so:
import _ from 'lodash'
export default {
created() {
this.logMessage = _.debounce(this.logMessage, 2000)
},
methods: {
logMessage() {
console.log('I only get fired once every two seconds, max!')
}
}
}
1: https://forum.vuejs.org/t/lodash-debounce-not-working-when-placed-inside-a-method/86334/5