Skip to content

Instantly share code, notes, and snippets.

@jrolfs
Created August 29, 2012 19:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrolfs/3517951 to your computer and use it in GitHub Desktop.
Save jrolfs/3517951 to your computer and use it in GitHub Desktop.
Backbone accessor methods
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