Permalink
Browse files

Propagate events:{}

  • Loading branch information...
1 parent 2ef52bc commit e35183ba857615d06e52ebf8c26621319ab3c0d3 @tbassetto tbassetto committed Oct 31, 2012
Showing with 9 additions and 6 deletions.
  1. +1 −6 lib/uielement.js
  2. +8 −0 lib/view.js
View
@@ -19,11 +19,6 @@
define(["joshlib!view"], function(View) {
-
- var UIElement = View.extend({
-
- });
-
+ var UIElement = View.extend({});
return UIElement;
-
});
View
@@ -77,6 +77,14 @@ define([
} else {
this.data = {};
}
+
+ /* If a subview declared events: {} properly (à la Backbone), copy them and associated callbacks */
+ this.events = options.events || null;
+ for (var eventCallbackName in this.events) {
+ if (this.events.hasOwnProperty(eventCallbackName)) {
+ this[this.events[eventCallbackName]] = options[this.events[eventCallbackName]];
+ }
+ }
},
/**

0 comments on commit e35183b

Please sign in to comment.