Site Navigation
Loading content dynamically
written by vegu on 22 Jan, 2007 12:30:15
In the
live demonstration of vegUI i am loading all the windows dynamically. What does that mean? With dynamically i mean they're only loaded and built if they are needed.
I use the
include() function of the vegUI manager object to do this. It can include a file that holds javascript code and eval the content in it. For example take a look at the file that i use to build and show the comment editor in the demonstation:
http://demo.vegui.org/module/comment/js/build.jsSince the code is eval'ed in the Manager's include function the this keyword points to the manager itself, which can come in kind of handy. The code in the build.js file checks if there is a child of the manager by the name of BlogComment and if there isnt it themes, builds and shows it. If the child already exists , that means that the comment editor was already themed and built before in which case the script only proceeds to show it.
This is nice when you have bigger web applications and do not want them to load everything at the time the application is loaded as this can cause some longer loading times relative to the size of the application.
Related Posts
Your Comment
Comments
No comments yet.