Created
August 29, 2012 19:52
-
-
Save jrolfs/3517951 to your computer and use it in GitHub Desktop.
Backbone accessor methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MyView = Backbone.View.extend((function () { | |
// ---------- Private ---------- | |
var _cantTouchThis = 0; | |
var _template; | |
return { | |
// | |
// -------------------- Init -------------------- | |
// | |
initialize: function () { | |
_template = '<div></div>'; | |
}, | |
// | |
// -------------------- Control -------------------- | |
// | |
render: function () { | |
this.$el.html(_template(data)); | |
return this; | |
}, | |
// ---------- Accessors ---------- | |
/** | |
* 'touched it' ಠ_ಠ | |
*/ | |
getCantTouchThis: function () { | |
return _cantTouchThis; | |
}, | |
setCantTouchThis: function (value) { | |
_cantTouchThis = value; | |
} | |
}; | |
}())); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment