]> git.r.bdr.sh - rbdr/serpentity/blobdiff - lib/serpentity/component.js
Components extend without having to define init
[rbdr/serpentity] / lib / serpentity / component.js
index 0204e302c8a4f823d011f4f90b0602d8ebe866fd..0018a880413a7b8c6f02272bbb6081a0ca032971 100644 (file)
@@ -5,5 +5,17 @@
  * components can be any class whatsoever.
  */
 Class(Serpentity, "Component")({
+    prototype : {
+        init : function init(config) {
+            var property;
 
+            config = config || {};
+
+            for (property in config) {
+                if (config.hasOwnProperty(property)) {
+                    this[property] = config[property];
+                }
+            }
+        }
+    }
 });