Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to reload automaticaly in vue

Vue.component('events', {
    template: '#events-template',

    data () {
        return {
            list: [],
            timer: ''
        }
    },
    created () {
        this.fetchEventsList();
        this.timer = setInterval(this.fetchEventsList, 300000);
    },
    methods: {
        fetchEventsList () {
            this.$http.get('events', (events) => {
                this.list = events;
            }).bind(this);
        },
        cancelAutoUpdate () {
            clearInterval(this.timer);
        }
    },
    beforeDestroy () {
      this.cancelAutoUpdate();
    }
});

new Vue({
    el: 'body',
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: slice string javascript 
Javascript :: js number to string 
Javascript :: get parent class javascript 
Javascript :: electron open dev tools 
Javascript :: Error: [Home] is not a <Route component. All component children of <Routes must be a <Route or <React.Fragment 
Javascript :: what is undefined in javascript 
Javascript :: nodejs get file stats 
Javascript :: jquery creating several items 
Javascript :: sorting algorithms in node.js 
Javascript :: head first javascript programming 
Javascript :: get contents between tags javascript 
Javascript :: createElement calls with JSX 
Javascript :: jquery append method 
Javascript :: error message to show in label jquery 
Javascript :: jquery get data attribute value by class 
Javascript :: deparam javascript 
Javascript :: universal mobile number regex 
Javascript :: how to include a toasted property in vue 
Javascript :: replit node version 
Javascript :: window.print() specific div 
Javascript :: javascript sanitize html 
Javascript :: node js arabic number to english number 
Javascript :: how to draw a flower in javascript 
Javascript :: material ui navbar 
Javascript :: filepond remove uploaded file 
Javascript :: angular async 
Javascript :: how to know how many pixels of page be scrolled javascript 
Javascript :: angular 7 selected 
Javascript :: JS cast a Number into a String 
Javascript :: array.length in mongoose query 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =