Skip to content

Instantly share code, notes, and snippets.

@mnelson
Created October 1, 2011 20:57
Show Gist options
  • Save mnelson/1256651 to your computer and use it in GitHub Desktop.
Save mnelson/1256651 to your computer and use it in GitHub Desktop.
The basic format to follow when defining your own renderable.
var d = new Diabox({parser : function(target){
// use target string to determine the renderable key. ie 'custom_key'
// return null if the target does not fit your criteria
}});
// d is a diabox instance
d.register_renderable('custom_key', Diabox.MyCustomRenderable);
Diabox.MyCustomRenderable = new Class({
Extends : Diabox.Renderable,
render : function(){
if(!this.retrieved()){
var content = // utilize this.target to generate content
this.set_content(content);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment