src/js/data.js
branchpopcorn-port
changeset 128 f3fec80dd31c
parent 108 62da43e72e30
child 174 7a6450d251fc
--- a/src/js/data.js	Mon Oct 24 16:51:22 2011 +0200
+++ b/src/js/data.js	Mon Oct 24 17:25:54 2011 +0200
@@ -34,7 +34,7 @@
 IriSP.Serializer.prototype.currentMedia = function() {  
 };
 
-IriSP.Serializer.prototype.sync = function(callback) {
+IriSP.Serializer.prototype.sync = function(callback) {  
   callback.apply(this, []);  
 };
 
@@ -42,13 +42,19 @@
   this._dataloader = DataLoader;
 };
 
-IriSP.SerializerFactory.prototype.getSerializer = function(config) {
+IriSP.SerializerFactory.prototype.getSerializer = function(metadataOptions) {
   /* This function returns serializer set-up with the correct
-     configuration
+     configuration - takes a metadata struct describing the metadata source
   */
-  switch(config.metadata.load) {
+  switch(metadataOptions.type) {
     case "json":
-      return new IriSP.JSONSerializer(this._dataloader, config.metadata.src);
+      return new IriSP.JSONSerializer(this._dataloader, metadataOptions.src);
+      break;
+    
+    case "dummy": /* only used for unit testing - not defined in production */
+      return new IriSP.MockSerializer(this._dataloader, metadataOptions.src);
+      break;
+      
     default:
       return undefined;
   }