src/js/data.js
branchpopcorn-port
changeset 69 3f7a2e8a948f
parent 65 6a8cae20f190
child 70 3f86d4126491
equal deleted inserted replaced
68:5469b2b9743f 69:3f7a2e8a948f
    38   return JSON.stringify(data);
    38   return JSON.stringify(data);
    39 };
    39 };
    40 
    40 
    41 IriSP.JSONSerializer.prototype.deserialize = function(data) {
    41 IriSP.JSONSerializer.prototype.deserialize = function(data) {
    42   return JSON.parse(data);
    42   return JSON.parse(data);
       
    43 };
       
    44 
       
    45 IriSP.JSONSerializer.prototype.sync = function(callback) {
       
    46   /* we don't have to do much because jQuery handles json for us */
       
    47   var wrapper = function(obj) {
       
    48     return function(data) {    
       
    49       obj._data = data;
       
    50       callback(data);
       
    51     }
       
    52   };
       
    53   
       
    54   this._DataLoader.get(this._url, wrapper(this));
    43 };
    55 };
    44 
    56 
    45 IriSP.SerializerFactory = function(DataLoader) {
    57 IriSP.SerializerFactory = function(DataLoader) {
    46   this._dataloader = DataLoader;
    58   this._dataloader = DataLoader;
    47 };
    59 };