Namespace: Widget

Widget

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

ControllerClass

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:

<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:

<private, inner> onReconnect :callbackGeneric

Fired on reestablishment of User Server XMPP connection. Facilitates event cascade to all Widgets.

Type:
Source:
See:

<private, inner> onUnload :callbackGeneric

Fired on reestablishment of User Server XMPP connection. Facilitates event cascade to all Widgets.

Type:
Source:
See:

Methods

<static> add(type, $context)

Creates a Widget of specified type within the Starlet.

Parameters:
Name Type Argument Default Description
type String

Type of widget to load resources for, must exist as a subdirectory in 'widgets'.

$context jQuery | Element <optional>
$('section#content')

Element to act as root.

Deprecated:
  • since version 2.1
Source:
See:
To Do:

<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
type String

Type of widget to load resources for, must exist as a subdirectory in 'widgets'.

parameters Object

Attributes that would normally be detected on Widget tag.

baseUrl String <optional>

Location of widgets directory, if nonstandard.

Deprecated:
  • since version 2.1
Source:
See:
To Do:
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
definition Object

Structure with which to extend Widget, must include override for onRun to initiate any behavior.

Deprecated:
  • since version 2.1
Source:
See:
To Do:
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
scope jQuery | 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
typeFilter String <optional>
''

Type to list, or undefined for all.

Source:
See:
Returns:

Widget controller instances.

Type
Array:.<Object:>

Opens a lightbox overlay with specific location and dimensions.

Parameters:
Name Type Description
name String

Framework name of new WebView.

url String

Location to open in lightbox.

width Number

Width at which to open lightbox.

height Number

Height at which to open lightbox.

Source:
See:
Returns:
Type
Object

Closes a lightbox overlay by name.

Parameters:
Name Type Description
name String

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
type String

Type of widget to load resources for, must exist as a subdirectory in 'widgets'.

baseUrl String <optional>

Location of widgets directory, if nonstandard.

Source:
See:
Returns:

jQuery AJAX request.

Type
Object

Creates a Bootstrap modal dialog in a manner that forces a consistent z-index.

Parameters:
Name Type Argument Default Description
html String

Raw html to pass through to Bootstrap modal method.

options Object <optional>
{}

Additional options.

Properties
Name Type Argument Default Description
className String <optional>

Custom CSS class name to add to modal element.

backdrop Boolean | String <optional>
'static'

Whether to include backdrop, and to allow click to dismiss.

keyboard Boolean <optional>
true

Whether to allow esc to dismiss.

show Boolean <optional>
true

Whether to show immediately.

remote Boolean | String <optional>
false

Remote content URL.

Source:
See:
Returns:
Type
Object

Controls Bootstrap modal dialog.

Parameters:
Name Type Description
action String

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
widget Object | jQuery

Controller or element of Widget to remove.

Source:
See: