Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

window vue remove event listener

// You can use the destroy() method to remove the event listener.
// The 'this' is bound automatically inside the listener somehow

mounted() {
    window.addEventListener('scroll', this.handleScroll)
},

destroyed() {
    window.removeEventListener('scroll', this.handleScroll)
},
Source by laracasts.com #
 
PREVIOUS NEXT
Tagged: #window #vue #remove #event #listener
ADD COMMENT
Topic
Name
3+6 =