src/js/data.js
branchpopcorn-port
changeset 128 f3fec80dd31c
parent 108 62da43e72e30
child 174 7a6450d251fc
equal deleted inserted replaced
127:3ce493c93d6c 128:f3fec80dd31c
    32 IriSP.Serializer.prototype.deserialize = function(data) {};
    32 IriSP.Serializer.prototype.deserialize = function(data) {};
    33 
    33 
    34 IriSP.Serializer.prototype.currentMedia = function() {  
    34 IriSP.Serializer.prototype.currentMedia = function() {  
    35 };
    35 };
    36 
    36 
    37 IriSP.Serializer.prototype.sync = function(callback) {
    37 IriSP.Serializer.prototype.sync = function(callback) {  
    38   callback.apply(this, []);  
    38   callback.apply(this, []);  
    39 };
    39 };
    40 
    40 
    41 IriSP.SerializerFactory = function(DataLoader) {
    41 IriSP.SerializerFactory = function(DataLoader) {
    42   this._dataloader = DataLoader;
    42   this._dataloader = DataLoader;
    43 };
    43 };
    44 
    44 
    45 IriSP.SerializerFactory.prototype.getSerializer = function(config) {
    45 IriSP.SerializerFactory.prototype.getSerializer = function(metadataOptions) {
    46   /* This function returns serializer set-up with the correct
    46   /* This function returns serializer set-up with the correct
    47      configuration
    47      configuration - takes a metadata struct describing the metadata source
    48   */
    48   */
    49   switch(config.metadata.load) {
    49   switch(metadataOptions.type) {
    50     case "json":
    50     case "json":
    51       return new IriSP.JSONSerializer(this._dataloader, config.metadata.src);
    51       return new IriSP.JSONSerializer(this._dataloader, metadataOptions.src);
       
    52       break;
       
    53     
       
    54     case "dummy": /* only used for unit testing - not defined in production */
       
    55       return new IriSP.MockSerializer(this._dataloader, metadataOptions.src);
       
    56       break;
       
    57       
    52     default:
    58     default:
    53       return undefined;
    59       return undefined;
    54   }
    60   }
    55 };
    61 };
    56 
    62