src/js/widgets.js
branchrequire-js
changeset 238 6008172a0592
parent 170 5150ae56e0a6
--- a/src/js/widgets.js	Mon Nov 14 16:12:13 2011 +0100
+++ b/src/js/widgets.js	Mon Nov 14 17:19:26 2011 +0100
@@ -1,43 +1,45 @@
 /* the widget classes and definitions */
 
-IriSP.Widget = function(Popcorn, config, Serializer) {
+define(["IriSP"], function() {
+  IriSP.Widget = function(Popcorn, config, Serializer) {
 
-  if (config === undefined || config === null) {
-    config = {}
-  }
-  
-  this._Popcorn = Popcorn;
-  this._config = config;  
-  this._serializer = Serializer;
-  
-  if (config.hasOwnProperty("container")) {
-     this._id = config.container;
-     this.selector = IriSP.jQuery("#" + this._id);
-  }
+    if (config === undefined || config === null) {
+      config = {}
+    }
+    
+    this._Popcorn = Popcorn;
+    this._config = config;  
+    this._serializer = Serializer;
+    
+    if (config.hasOwnProperty("container")) {
+       this._id = config.container;
+       this.selector = IriSP.jQuery("#" + this._id);
+    }
 
-  if (config.hasOwnProperty("width")) {
-     // this.width and not this._width because we consider it public.
-     this.width = config.width;     
-  }
-  
-  if (config.hasOwnProperty("height")) {    
-     this.height = config.height;     
-  }
-  
-  if (config.hasOwnProperty("heightmax")) {
-     this.heightmax = config.heightmax;     
-  }
+    if (config.hasOwnProperty("width")) {
+       // this.width and not this._width because we consider it public.
+       this.width = config.width;     
+    }
+    
+    if (config.hasOwnProperty("height")) {    
+       this.height = config.height;     
+    }
+    
+    if (config.hasOwnProperty("heightmax")) {
+       this.heightmax = config.heightmax;     
+    }
 
-  if (config.hasOwnProperty("widthmax")) {
-     this.widthmax = config.widthmax;     
-  }
-  
-};
+    if (config.hasOwnProperty("widthmax")) {
+       this.widthmax = config.widthmax;     
+    }
+    
+  };
 
-IriSP.Widget.prototype.draw = function() {
-  /* implemented by "sub-classes" */  
-};
+  IriSP.Widget.prototype.draw = function() {
+    /* implemented by "sub-classes" */  
+  };
 
-IriSP.Widget.prototype.redraw = function() {
-  /* implemented by "sub-classes" */  
-};
+  IriSP.Widget.prototype.redraw = function() {
+    /* implemented by "sub-classes" */  
+  };
+});
\ No newline at end of file