Created
October 1, 2011 20:57
-
-
Save mnelson/1256651 to your computer and use it in GitHub Desktop.
The basic format to follow when defining your own renderable.
This file contains hidden or 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 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 | |
}}); |
This file contains hidden or 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
// d is a diabox instance | |
d.register_renderable('custom_key', Diabox.MyCustomRenderable); |
This file contains hidden or 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
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