-
Notifications
You must be signed in to change notification settings - Fork 20
Sqwidget Loading sequence
grasuth edited this page Nov 11, 2010
·
2 revisions
This is a quick description of the loading and execution sequence of Sqwidget and widgets in a single page.
Loading and execution happens in the following order:
-
sqwidget.js
loads. It can be loaded asynchronously if required. - Sqwidget object added to the global namespace.
- Sqwidget looks for jQuery and loads it from google cdn if not already loaded.
- If the global config setting
automatic
istrue
, then sqwidget searches for any widgets in the page. These are identified by looking for any<div data-sqwidget="..."></div>
elements in the page. Note, if not set to automatic, see below for how to make things start. - Sqwidget reads
src:
attributes fromdata-sqwidget
attributes in embed divs. - Sqwidget loads widget source files
- Style elements extracted from sources and added to the page head
- Controller scripts extracted from sources
- Templates (sub-templates) extracted from each widget source source
- Controller scripts executed -- allowing registration of plugin dependencies using widget.config({});
- template dependencies are registerd and loading starts
- template controller registration is done (widget.ready, widget.loading, widget.error are registered)
- if widget.loading defined, then this is executed, or if there is a template with id='loading' that is loaded into the whole widget When all dependencies are loaded for a particular widget:
-
widget.ready()
is run
I have used it on my website Sell tickets online No Fee