View Single Post
Old 01-21-2013, 04:34 PM   PM User | #6
Kyle123
New Coder

 
Join Date: Jan 2013
Posts: 10
Thanks: 3
Thanked 1 Time in 1 Post
Kyle123 is an unknown quantity at this point
IF anyone's interested in a similar project, I found that the most efficient/neatest way of doing this is through a module loading library. I've used requirejs, the basic method is:

A main loading module that handles all the desktop set up and handles the loading of additional modules. Standalone js modules are then called as required and added to the desktop, these are pure js/jquery modules containing no html. Each of them contain a url to the html for the "widget" which is called by the main desktop js.

This approach has allowed a lot of flexibility, where the widget html content needs to be rendered by the server the page is called via ajax, otherwise the js in the widget builds the html.

requireJS has also reduced initial loading times since there's no requirement to load js libraries that aren't linked to widgets just in-case the user wants to use them
Kyle123 is offline   Reply With Quote