Skip to content

Instantly share code, notes, and snippets.

@hafriedlander
Created May 19, 2012 03:42
Show Gist options
  • Save hafriedlander/2728933 to your computer and use it in GitHub Desktop.
Save hafriedlander/2728933 to your computer and use it in GitHub Desktop.
Entwine create property on first access pattern
$('selector').entwine({
Editor: null,
createEditor: function(){
return createTheEditorSomehow();
},
getEditor: function(){
var val = this._super();
if (!val) this.setEditor(val = this.createEditor());
return val;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment