new AutoLauncher()
Helper class to create and bind Kekule widgets while loading HTML page.
Generally, the auto launcher will iterate through elements in document. If an element is
with a data-widget attribute, it will be regarded as a Kekule related one. Then a
specified Kekule widget will be created (according to data-widget attribute) on this tag.
Widget property will also be set from "data-XXX" attribute.
Members
-
(static) deferring
-
If true, the launch process on each element will be deferred, try not to block the UI.
-
(static) enableCascadeLaunch
-
A flag to enable or disable launching child widgets inside a widget element.
-
(static) enabled
-
A flag to turn on or off auto launcher.
-
(static) enableDynamicDomCheck
-
A flag to enable or disable checking dynamic inserted content in HTML page.
-
(static) enableOnEditable
-
A flag to enable or disable launching widgets on element in HTML editor (usually should not).
-
(static) PlaceHolderStrategies
-
PlaceHolder creation strategy for autolauncher
Properties:
Name Type Description DISABLED
PlaceHolder will be totally disabled. IMPLICIT
Placeholder will be created when possible. EXPLICIT
Placeholder will only be created when attribute placeholder is explicitly set to true in element. -
(static) placeHolderStrategy
-
If true, Placeholder maybe created during auto launching.
Methods
-
execute(rootElem, deferCreation, callback)
-
Launch all widgets inside element.
Parameters:
Name Type Description rootElem
HTMLElement deferCreation
Bool callback
Func A callback function that will be called when the task is done (since deferCreation may be true). -
executeOnElemBySelector(doc, rootElem, parentWidget)
-
Execute launch process on element and its children. Widget created will be set as child of parentWidget. This method will use querySelector method to perform a fast launch on supported browser.
Parameters:
Name Type Description doc
HTMLDocument rootElem
HTMLElement parentWidget
Kekule.Widget.BaseWidget Can be null. -
isElemLaunchable(elem) → {Bool}
-
Return whether the element should be launched as a widget.
Parameters:
Name Type Description elem
HTMLElement Returns:
- Type
- Bool