Reference
The reference documentation provided in the following sections describes the Widget SDK structure and methods, and the widget UI definition.
The Widget SDK returns an object with the following properties and methods:
Properties
The widget object has the following properties:
compositionId
String
"-NIqFVJ1rRnNsiUQJing"
The ID of a (sub)composition.
instanceId
String
The ID of a widget composition instance.
widgetId
Number
4215
The ID of a widget template.
widgetVersion
Number
1
The version of a widget.
Methods
The widget object has the following methods:
-
Registers callback functions for onInit
, onValue
, onButtonClicked
, onEditComp
, and onAnimation
events.
createTimeControl()
Returns a Singular timer control object.
Use createTimeControl()
to manage timers and synchronize them globally in all composition and output instances.
Parameter
none
Return
object
: Time control object
See also
init()
Initializes and registers callback functions.
Parameter
The init()
function defines callback functions for events in a JSON object.
onInit
Called when loading a composition, adding a widget, or closing a widget composition.
onValue
Called when changing a value in a widget UI field.
onButtonClicked
Called when clicking a button in a widget UI.
onEditComp
Called when starting to edit a widget composition. Creates and initializes widget nodes in this callback.
onAnimation
Called when a widget supports custom widget animations and a user selected using the widget animation in the animation timeline.
Also see
Return
none
instantiate()
Creates an instance of a composition and initializes it. This function is only required when a widget supports widget compositions.
Parameter
compositionID
string
A Composition ID returned by the onValue() function.
domElement
html
An HTML dom element.
cb
function
The callback function.
Return
object
: Composition Instance
See also
sendCustomMessage()
Sends a custom message to the composition script. Registers a message listener in composition script to receive and process the message object.
Parameter
message
string, number, object
A message object.
Return
none
Last updated