Skip to content

How to do polling with Inertia #501

Discussion options

You must be logged in to vote

Hello guys,

I just wanted to give you a short feedback on my own question, because this is very easy to do with inertia.

Taking into account how polling should be done in vue (by creating the SetInterval function, google for this or give feedback, if this is not best practice), the way to go is like so:

        methods: {
         updateData() {
            this.$inertia.reload({ preserveState: true , preserveScroll: true })  // read about the possible options under manual visits.
          },
        },
        created() {
          this.interval = setInterval(function () {
              this.updateData();
          }.bind(this), 1000);  // set 1000 to any number you need
        },
    …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by cwaidelich
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants