Meteor Timers - Meteor

What is the use of Timers in Meteor?

Meteor provides its own setTimeout and setInterval methods and these methods are used to make sure that all global variables have correct values. They work like regular JavaScript setTimout and setInterval.

Timeout

This is Meteor.setTimeout example.

Timeout function is called in the console once the app has started.

meteor-timeout

Interval

Next example is showing how to set and clear interval.

meteorApp.html

We will set the initial counter variable which will be updated after every interval call.

meteorApp.js

Console will log the updated counter variable every three seconds. This can be stopped by clicking CLEAR button and this will call clearInterval method.

meteor-interval

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Meteor Topics