From 60a6915a0b24975e28a02b28e43d34f6dbb15625 Mon Sep 17 00:00:00 2001 From: Ben Beltran Date: Tue, 12 Aug 2014 19:25:52 -0500 Subject: Components extend without having to define init --- lib/serpentity/component.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib') diff --git a/lib/serpentity/component.js b/lib/serpentity/component.js index 0204e30..0018a88 100644 --- a/lib/serpentity/component.js +++ b/lib/serpentity/component.js @@ -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]; + } + } + } + } }); -- cgit