function ViewModel() {
    "use strict";
    var self = this;
    self.raceSessions = ko.observable();

    $.get("/api/monitor", {}, self.raceSessions);
    self.tmrHandle = setTimeout(function () {
        self.getData();
    }, 2000);

    self.getData = function () {
        $.get("/api/monitor", {}, self.raceSessions)
            .done(function() {
                console.log("done");
            })
            .always(function() {
                self.tmrHandle = setTimeout(self.getData, 2000);
            });
    };
};

ViewModel.prototype.dispose = function () {
    "use strict";
    window.clearInterval(self.tmrHandle);
    console.log("disposed of timer");
};

ko.applyBindings(new ViewModel());