function ViewModel() {
    "use strict";
    var self = this;
    self.raceSession = ko.observable(new RaceSession({id:-1, createdDate:"", updatedAt:"", title:"", active:false, mode:0, maxLaps:0, deletedAt:"", satelliteCount:0,timePenaltyPerSatellite:0, hotSeatEnabled:true, idleTimeSeconds:50}));
    self.lastId = ko.observable(new LastScannedId({id:-1}));
    //self.raceSessions = ko.observable();

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

    self.getLastId = function() {
        $.get("/api/system/lasttoken", {},
            function (data) {
                self.lastId(new LastScannedId(data));
            })
            .always(function () {
                self.tmrHandle = setTimeout(self.getLastId, 2000);
            });
    };
    //self.getData = function () {
    //    $.get("/api/monitor", {}, self.raceSession)
    //        .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());