/**
 * Created by DennysO on 6/27/2015.
 */
var States = {};

var notifyStatesComponents = function(id) {
    ////console.log(id);
    $(StatesEntity).trigger(id);
};

var StatesEntity = {
    doneLoading: false,
    get: function() {
        return States;
    },
    all: function() {
        var loadRequest = $.ajax({
            type: 'GET',
            url: "/api/getAll/states",
            dataType: "json"
        });
        loadRequest.done(function(dataFromServer) {
            States = dataFromServer;
            notifyStatesComponents('GetAllStates');
        });
    },
};