diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-08-22 19:41:37 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-08-22 19:41:37 -0400 |
| commit | 2235c34e498499b8141e835998b962067583a0ce (patch) | |
| tree | 22406e6484a7cccc1c72fb47cc4e5848f57ee2c4 /public/assets/javascripts/ui/lib/View.js | |
| parent | ed5751766079a62ce596dcc0abc1a211b5b633dc (diff) | |
| parent | 4ef340497ef24bb2ecacb2c9c4106c24515c874f (diff) | |
merge
Diffstat (limited to 'public/assets/javascripts/ui/lib/View.js')
| -rw-r--r-- | public/assets/javascripts/ui/lib/View.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/public/assets/javascripts/ui/lib/View.js b/public/assets/javascripts/ui/lib/View.js index 999a0e5..d94e6db 100644 --- a/public/assets/javascripts/ui/lib/View.js +++ b/public/assets/javascripts/ui/lib/View.js @@ -1,13 +1,14 @@ var View = (function($, _){ var View = function(options) { - this.cid = _.uniqueId('view'); + this._id = _.uniqueId('view') + this.type = "view" options || (options = {}); - _.extend(this, _.pick(options, viewOptions)); - this._ensureElement(); - this.initialize.apply(this, arguments); - this.delegateEvents(); - }; + _.extend(this, _.pick(options, viewOptions)) + this._ensureElement() + this.initialize.apply(this, arguments) + this.delegateEvents() + } var delegateEventSplitter = /^(\S+)\s*(.*)$/; @@ -58,7 +59,7 @@ var View = (function($, _){ var match = key.match(delegateEventSplitter); var eventName = match[1], selector = match[2]; method = _.bind(method, this); - eventName += '.delegateEvents' + this.cid; + eventName += '.delegateEvents' + this._id; if (selector === '') { this.$el.on(eventName, method); } else { @@ -70,7 +71,7 @@ var View = (function($, _){ // Clears all callbacks previously bound to the view with `delegateEvents`. undelegateEvents: function() { - this.$el.off('.delegateEvents' + this.cid); + this.$el.off('.delegateEvents' + this._id); return this; }, |
