JSFiddle - React, Tailwind, and code Playground
JavaScript
var Bot = function () {
this.updateInterval = 5000;
this.updateTimer = null;
};
Bot.prototype.getUpdates = function () {
var self = this;
alert("b " + self.updateInterval); // returns "b undefined"
};
Bot.prototype.init = function () {
var self = this;
$.get('/', function (data, status) {
alert("a " + self.updateInterval); // returns "a 5000"
self.updateTimer = setInterval(self.getUpdates.bind(self), self.updateInterval);
});
};
window.bot = new Bot();
window.bot.init();