Handles loading and management of Widget-specific content, ensuring all necessary information is present. Detect dynamically added widgets with Widget.detect(), the rest is automatic. Definitions, flags, and instances stored by type in Widget.types. Definitions require title, onRun, and onReconnect.
- Source:
Classes
Members
-
<private, static> detected :Boolean
-
Whether the detect method has been called at least once.
Type:
- Source:
-
<static, readonly> root :String
-
Path to widgets directory.
Type:
- Source:
-
<static, readonly> types :Object
-
Index of all Widget types that have been detected.
Type:
- Source:
-
<private, inner> onDisconnect :callbackGeneric
-
Fired on termination of User Server XMPP connection. Facilitates event cascade to all Widgets.
Type:
- Source:
- See:
-
- Widget.ControllerClass#onDisconnect
- Starlet.onDisconnect
- Widget~onReconnect
- Widget~onUnload
- Widget~onExit
-
<private, inner> onExit :callbackGeneric
-
Fired before unloading Starlet, but only when Framework is about to exit. Expect no more than ~200ms before WebView stops. Facilitates event cascade to all Widgets.
Type:
- Source:
- See:
-
- Widget.ControllerClass#onExit
- Starlet.onExit
- Widget~onDisconnect
- Widget~onReconnect
- Widget~onUnload
-
<private, inner> onReconnect :callbackGeneric
-
Fired on reestablishment of User Server XMPP connection. Facilitates event cascade to all Widgets.
Type:
-
<private, inner> onUnload :callbackGeneric
-
Fired on reestablishment of User Server XMPP connection. Facilitates event cascade to all Widgets.
Type:
- Source:
- See:
-
- Widget.ControllerClass#onRemove
- Starlet.onUnload
- Widget~onDisconnect
- Widget~onReconnect
- Widget~onExit
Methods
-
<static> add(type, $context)
-
Creates a Widget of specified type within the Starlet.
Parameters:
Name Type Argument Default Description typeString Type of widget to load resources for, must exist as a subdirectory in 'widgets'.
$contextjQuery | Element <optional>
$('section#content') Element to act as root.
- Deprecated:
-
- since version 2.1
- Source:
- See:
- To Do:
-
- Make Widget a constructor to replace Widget.add/Widget.create, make Widget.remove a method of instantiated Widget controllers.
-
<static> create(type, parameters, baseUrl) → {jQuery|Element}
-
Creates a Widget of specified type within the Starlet, but in a way that avoids Widget.detect.
Parameters:
Name Type Argument Description typeString Type of widget to load resources for, must exist as a subdirectory in 'widgets'.
parametersObject Attributes that would normally be detected on Widget tag.
baseUrlString <optional>
Location of widgets directory, if nonstandard.
- Deprecated:
-
- since version 2.1
- Source:
- See:
- To Do:
-
- Make Widget a constructor to replace Widget.add/Widget.create, make Widget.remove a method of instantiated Widget controllers.
Returns:
Widget's containing element.
- Type
- jQuery | Element
-
<static> define(definition) → {Object}
-
Extends Widget with custom properties, methods, and callbacks. Call this in your Widget directory's index.js, it signifies to the synchronizer that fundamental custom Widget resources have been loaded and parsed.
Parameters:
Name Type Description definitionObject Structure with which to extend Widget, must include override for onRun to initiate any behavior.
- Deprecated:
-
- since version 2.1
- Source:
- See:
-
- Widget.ControllerClass#attributes
- Widget.ControllerClass#onRun
- Widget.ControllerClass#onDisconnect
- Widget.ControllerClass#onReconnect
- Widget.ControllerClass#onUnload
- Widget.ControllerClass#onExit
- Widget.ControllerClass#onStarletVisible
- Widget.ControllerClass#onStarletActive
- Widget.ControllerClass#onStarletFocused
- Widget.ControllerClass#onStarletMinimized
- Widget.ControllerClass#onStarletHidden
- Widget.ControllerClass#onStarletMouse
- To Do:
-
- Document definition, Make Widget a constructor to replace Widget.add/Widget.create, make Widget.remove a method of instantiated Widget controllers.
Returns:
Widget definition reference.
- Type
- Object
-
<static> detect(scope) → {Number}
-
Queries DOM for any uninitialized widgets, initializes new Widget controllers.
Parameters:
Name Type Argument Default Description scopejQuery | Element <optional>
undefined Root element to query within.
- Source:
- See:
Returns:
Count of new Widget types detected.
- Type
- Number
-
<static> instances(typeFilter) → {Array:.<Object:>}
-
Lists all Widget controllers within Starlet.
Parameters:
Name Type Argument Default Description typeFilterString <optional>
'' Type to list, or undefined for all.
- Source:
- See:
Returns:
Widget controller instances.
-
<static> lightbox(name, url, width, height) → {Object}
-
Opens a lightbox overlay with specific location and dimensions.
Parameters:
Name Type Description nameString Framework name of new WebView.
urlString Location to open in lightbox.
widthNumber Width at which to open lightbox.
heightNumber Height at which to open lightbox.
- Source:
- See:
Returns:
- Type
- Object
-
<static> lightbox(name) → {Object}
-
Closes a lightbox overlay by name.
Parameters:
Name Type Description nameString Framework name of WebView to close.
- Source:
- See:
Returns:
- Type
- Object
-
<static> load(type, baseUrl) → {Object}
-
Fetches assets associated with a particular Widget type.
Parameters:
Name Type Argument Description typeString Type of widget to load resources for, must exist as a subdirectory in 'widgets'.
baseUrlString <optional>
Location of widgets directory, if nonstandard.
- Source:
- See:
Returns:
jQuery AJAX request.
- Type
- Object
-
<static> modal(html, options) → {Object}
-
Creates a Bootstrap modal dialog in a manner that forces a consistent z-index.
Parameters:
Name Type Argument Default Description htmlString Raw html to pass through to Bootstrap modal method.
optionsObject <optional>
{} Additional options.
Properties
Name Type Argument Default Description classNameString <optional>
Custom CSS class name to add to modal element.
backdropBoolean | String <optional>
'static' Whether to include backdrop, and to allow click to dismiss.
keyboardBoolean <optional>
true Whether to allow esc to dismiss.
showBoolean <optional>
true Whether to show immediately.
remoteBoolean | String <optional>
false Remote content URL.
- Source:
- See:
Returns:
- Type
- Object
-
<static> modal(action) → {Object}
-
Controls Bootstrap modal dialog.
Parameters:
Name Type Description actionString Action (show|hide|toggle) to pass through to Bootstrap modal method.
- Source:
- See:
Returns:
- Type
- Object
-
<static> remove(widget)
-
Fetches assets associated with a particular Widget type.
Parameters:
Name Type Description widgetObject | jQuery Controller or element of Widget to remove.
- Source:
- See: