dizmojs.Dizmo
- Dizmo
- Methods
- getAttribute(attributeName, options) → {String|Boolean|Number|Array}
- setAttribute(attributeName, value)
- subscribeToAttribute(attributeName, callback, subscribedCallback) → {String}
- subscribeToAttributeConditional(attributeName, condition, callback, subscribedCallback) → {String}
- unsubscribeAttribute(subscriptionId)
- beginAttributeUpdate(path)
- endAttributeUpdate(path)
- setPosition(x, y)
- getPosition() → {Object}
- close()
- addMenuItem(iconURI, text, callback) → {String}
- updateMenuItem(menuId, iconURI, text, callback)
- removeMenuItem(menuId)
- clone(attributes, A)
- getAttention(options)
- getDockedDizmos() → {Array}
- canDock(callback)
- onDock(callback, subscribedCallback)
- onUndock(callback, subscribedCallback)
- onShow(callback, subscribedCallback) → {String}
- onHide(callback, subscribedCallback) → {String}
- onMaximized(callback, subscribedCallback) → {String}
- onIconized(callback, subscribedCallback) → {String}
- onClosing(callback, subscribedCallback) → {String}
- onCancelClosing(callback, subscribedCallback) → {String}
- onDragStart(callback, subscribedCallback) → {String}
- onDragEnd(callback, subscribedCallback) → {String}
- onResizeStart(callback, subscribedCallback) → {String}
- onResizeEnd(callback, subscribedCallback) → {String}
- onShowFront(callback, subscribedCallback) → {String}
- onShowBack(callback, subscribedCallback) → {String}
- showFront()
- showBack()
- setSize(width, height)
- getSize() → {Object}
- setPositionAndSize(x, y, width, height)
- getWidth() → {Number}
- getHeight() → {Number}
- setWidth(width)
- setHeight(height)
- focus()
- getParentDizmo() → {dizmojs.Dizmo}
- setParentDizmo(otherDizmo) → {boolean}
- getChildDizmos() → {Array}
- getRootDizmo() → {dizmojs.Dizmo}
- getBundle() → {dizmojs.Bundle}
- remoteHostConnected() → {Boolean}
- getRemoteHost() → {dizmojs.RemoteHost}
- onRemoteHostConnected(callback, subscribedCallback) → {String}
- onRemoteHostDisconnected(callback, subscribedCallback) → {String}
- unsubscribeRemoteHost(subscriptionId)
- getAbsoluteGeometry() → {Object}
- onParentChanged(callback, subscribedCallback) → {String}
- unsubscribeParentChange(id)
- onChildrenAdded(callback, subscribedCallback) → {String}
- onChildrenRemoved(callback, subscribedCallback) → {string}
- unsubscribeChildren(id)
- share(remoteHostId, callback)
- unshare(remoteHostId, callback)
- clearSetup()
- Type Definitions
- attributeChangeCallback(path, newValue, oldValue)
- menuCallback()
- canDockCallback() → {Boolean}
- dockingCallback(dockedDizmo)
- parentChangeCallback(newParent)
- childrenAddedCallback(dizmos)
- childrenRemovedCallback(dizmos)
- showHideCallback()
- iconizedMaximizedCallback()
- backFrontCallback()
- closingCallback()
- dragCallback()
- resizeCallback()
- remoteHostConnectedCallback(remoteHost)
- remoteHostDisconnectedCallback(remoteHostId)
- onDizmoClonedCallback(dizmoInstance, error)
- onSubscriptionRegisteredCallback()
- storeBundleInstalledCallback(bundleId, error)
Dizmo
An instance of this class represents a single dizmo and allows reading and setting its attributes where permitted, as well as registering callbacks to listen for changes. Several convenience methods are provided to make access easier.
Each dizmo is provided with an instance of this class in the global
variable dizmo. It represents the dizmo itself. An instance
representing another dizmo can be obtained by passing its identifier to
the constructor, or via any method that directly returns an
instance.
new Dizmo(identifier)
Given the identifier of a dizmo, construct a new instance that
represents the dizmo.
represents the dizmo.
Parameters:
Name | Type | Description |
---|---|---|
identifier |
String | The identifier for the dizmo to be represented |
Throws:
-
If the provided identifier does not correspond to a dizmo
- Type
- DizmoNotExistsError
Members
-
identifier :String
-
The unique identifier of the represented dizmo
Type:
- String
Methods
-
getAttribute(attributeName, options) → {String|Boolean|Number|Array}
-
Get attributes saved on this dizmo. The following is a list of available attributes (please note that they are all case INsensitive!). One can also get the parent attribute: For example
dizmo.getAttribute('geometry')
; will return an object with all the values under geometry. This is recursive, so ALL children on ALL levels below the parent will be retrieved.Parameters:
Name Type Description attributeName
String The name of the attribute. For a list, refer to the data tree. options
Object Additional options for getting an attribute. Note that only one of the supplied options
can be true. The other has to be false or undefined (non existing).
{
values: {Boolean} If set to true, return the value of a single attribute
nodes: {Boolean} If set to true return the node names under an attribute parent
}Throws:
-
-
If the attribute does not exist
- Type
- AttributeDoesNotExistError
-
-
-
If the provided attribute name is not a string
- Type
- NotAStringError
-
Returns:
Depending on the attribute either a string, a number, a boolean or an array will be returned- Type
- String
|Boolean
|Number
|Array
-
-
setAttribute(attributeName, value)
-
Set an attribute of the dizmo (all attributes are case INsensitive!)
Parameters:
Name Type Description attributeName
String Name of the attribute. For a list, refer to the data tree. value
Number
|String
|Boolean
The value of the attribute to set Throws:
-
-
If the attribute does not exist
- Type
- AttributeDoesNotExistError
-
-
-
If the attribute requires the value to be a string, but the value is not a string
If the attribute name provided is not a string - Type
- NotAStringError
-
-
-
If the provided value for titleColor is not in the format “#4b4b4bff”
If the provided value for frameColor is not in the format “#4b4b4bff” - Type
- NotAColorStringError
-
-
-
If the attribute requires the value to be a number, but the value is not a number
- Type
- NotANumberError
-
-
-
If the attribute requires the value to be a boolean, but the value is not a boolean
- Type
- NotABooleanError
-
-
-
If the attribute is write protected
- Type
- AttributeNotWritableError
-
-
-
If the provided value for geometry/x is smaller than -3000 or bigger than 3000
If the provided value for geometry/y is smaller than -3000 or bigger than 3000
If the provided value for geometry/width is smaller than 65 and bigger than 5400
If the provided value for geometry/height is smaller than 50 and bigger than 5400
If the provided value for geometry/zoom is smaller than 0.1 or bigger than 10
If the provided value for geometry/angle is smaller than 0 or bigger than 360
If the provided value for stickygeometry/x is smaller than -3000 or bigger than 3000
If the provided value for stickygeometry/y is smaller than -3000 or bigger than 3000
If the provided value for stickygeometry/width is smaller than 65 and bigger than 5400
If the provided value for stickygeometry/height is smaller than 50 and bigger than 5400
If the provided value for stickygeometry/zoom is smaller than 0.1 or bigger than 10
If the provided value for stickygeometry/angle is smaller than 0 or bigger than 360
If the provided value for settings/frameOpacity is smaller than 0 or bigger than 1
If the provided value for settings/removeFadeTime is smaller than 0 or bigger than 5000 - Type
- OutOfRangeError
-
-
-
subscribeToAttribute(attributeName, callback, subscribedCallback) → {String}
-
Subscribe a callback to changes on the given attribute. If subscribing on a parent node, the changes that are made to any sub nodes will be listened to. This is as subscribing to a recursive node on the private/public store.
Parameters:
Name Type Argument Description attributeName
String The attribute on which to listen for changes. For a list, refer to the data tree. callback
dizmojs.Dizmo~attributeChangeCallback The function to call once changes have occurred subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
-
If the provided attribute is not a string
- Type
- NotAStringError
-
-
-
If the attribute does not exist
- Type
- AttributeDoesNotExistError
-
-
-
If the callback is not a function
- Type
- NotAFunctionError
-
Returns:
The subscription id- Type
- String
-
-
subscribeToAttributeConditional(attributeName, condition, callback, subscribedCallback) → {String}
-
Subscribe to an attribute and only call the given callback when the attribute is equal to the given condition
Parameters:
Name Type Argument Description attributeName
String The name of the attribute. For a list, refer to the data tree. condition
String
|Boolean
|Number
The value the attribute has to be equal to callback
dizmojs.Dizmo~attributeChangeCallback The function to call once the attribute is equal to the condition subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
-
If the provided attribute name is not a string
- Type
- NotAStringError
-
-
-
If the attribute does not exist
- Type
- AttributeDoesNotExistError
-
-
-
If the callback is not a function
- Type
- NotAFunctionError
-
Returns:
The subscription id- Type
- String
-
-
unsubscribeAttribute(subscriptionId)
-
Unsubscribe from the given attribute change
Parameters:
Name Type Description subscriptionId
String The subscription id returned from a subscribeToAttribute call Throws:
-
If the given subscription id is not a string
- Type
- NotAStringError
-
-
beginAttributeUpdate(path)
-
Start an attribute update. Any call to setAttribute after this call will be queued and executed
once the corresponding endAttributeUpdate() call has been invoked.Parameters:
Name Type Description path
String The path to the tree node which should be locked Throws:
-
-
If the provided path is not a string
- Type
- NotAStringError
-
-
-
If the attribute does not exist
- Type
- AttributeDoesNotExistError
-
-
-
endAttributeUpdate(path)
-
Stop an attribute update. Any call to setAttribute under the provided node that was blocked by a
corresponding beingAttributeUpdate call will now be executed.Parameters:
Name Type Description path
String The path to the tree node which should be unlocked Throws:
-
-
If the provided path is not a string
- Type
- NotAStringError
-
-
-
If the attribute does not exist
- Type
- AttributeDoesNotExistError
-
-
-
setPosition(x, y)
-
Set the position of the dizmo
Parameters:
Name Type Description x
Number The x coordinates the dizmo should be moved to y
Number The y coordinates the dizmo should be moved to Throws:
-
-
If the provided value for x or y is not a number
- Type
- NotANumberError
-
-
-
If the provided value for x is smaller than -3000 or bigger than 3000
If the provided value for y is smaller than -3000 or bigger than 3000 - Type
- OutOfRangeError
-
-
-
getPosition() → {Object}
-
Returns:
The position of the dizmo as an object- Type
- Object
-
close()
-
Close the dizmo
NOTE: This cannot be used on another dizmo -
addMenuItem(iconURI, text, callback) → {String}
-
Add a new menu item to the dizmo menu
Parameters:
Name Type Description iconURI
String URI of the icon for the new menu entry text
String The text for the new menu entry callback
dizmojs.Dizmo~menuCallback The function to call when a click on a menu occurs Throws:
-
-
If the icon URI is not a string
If the menu text is not a string - Type
- NotAStringError
-
-
-
If the callback is not a function
- Type
- NotAFunctionError
-
Returns:
The id for the menu entry- Type
- String
-
-
updateMenuItem(menuId, iconURI, text, callback)
-
Update an existing menu item
Parameters:
Name Type Description menuId
String The menu id required when updating or removing the item iconURI
String URI of the icon for the new menu entry text
String The text for the new menu entry callback
dizmojs.Dizmo~menuCallback The function to call when a click on a menu occurs Throws:
-
-
If the icon URI is not a string
If the menu text is not a string - Type
- NotAStringError
-
-
-
If the callback is not a function
- Type
- NotAFunctionError
-
-
-
If the menu id is not a number
- Type
- NotANumberError
-
-
-
removeMenuItem(menuId)
-
Remove a menu item
Parameters:
Name Type Description menuId
Number The id of the menu item to remove Throws:
-
If the menu id is not a number
- Type
- NotANumberError
-
-
clone(attributes, A)
-
Clone the dizmo, creating a new instance with the exact same private/public values. Attributes can be overwritten with key/value pairs. Details
Parameters:
Name Type Description attributes
Object
|undefinedAttributes to overwrite or undefined for taking over the same attributes A
dizmojs.Dizmo~onDizmoClonedCallback callback to be called when the dizmo has been cloneDizmo Throws:
-
-
If the provided attributes parameter is neither an object nor undefined
- Type
- NotAnObjectError
-
-
-
If the provided callback is not a function or undefined
- Type
- NotAFunctionError
-
-
-
getAttention(options)
-
Get the user’s attention with a dizmo animation. Supported animations are vibrate,
rotate and flash (more to come).Parameters:
Name Type Description options
Object {
type: {String} The type of attention animation
duration: {Number} The duration the animation should be played
}Throws:
-
-
If the provided type is not a string
- Type
- NotAStringError
-
-
-
If the type is not vibrate, rotate or flash
- Type
- WrongParameterError
-
-
-
If the provided duration is not a number
- Type
- NotANumberError
-
-
-
getDockedDizmos() → {Array}
-
Get a list of docked dizmos, as instances of the docked dizmos.
Returns:
An array of docked dizmo instances- Type
- Array
-
canDock(callback)
-
Provide either a function which returns true or false, or a boolean to decide whether the dizmo can dock or not.
Parameters:
Name Type Description callback
dizmojs.Dizmo~canDockCallback
|BooleanWhether the dizmo can dock or not (function has to return true/false) Throws:
-
If the function is called on a dizmo that is not the current active dizmo
- Type
- OutOfScopeError
-
-
onDock(callback, subscribedCallback)
-
The provided function will be called whenever a docking between the dizmo and another dizmo occurs.
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~dockingCallback The callback to call when a dizmo has been docked subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Example
dizmo.onDock(function(dockedDizmo) { me.subscriptionId = dockedDizmo.publicStorage.subscribeToProperty('stdout', function(path, val, oldVal) { console.log('stdout did change'); }); });
-
-
onUndock(callback, subscribedCallback)
-
The provided function will be called whenever a dizmo has been undocked
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~dockingCallback The callback to call when a dizmo has been docked subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Example
dizmo.onUndock(function(undockedDizmo) { undockedDizmo.publicStorage.unsubscribeProperty(me.subscriptionId); });
-
-
onShow(callback, subscribedCallback) → {String}
-
Provide a function which will be called whenever the dizmo is shown
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~showHideCallback The function to call subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Returns:
The subscription id- Type
- String
Example
dizmo.onShow(function() { console.log('dizmo is visible!'); });
-
-
onHide(callback, subscribedCallback) → {String}
-
Provide a function which will be called whenever the dizmo is hidden
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~showHideCallback The function to call subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Returns:
The subscription id- Type
- String
Example
dizmo.onHide(function() { console.log('dizmo is hidden!'); });
-
-
onMaximized(callback, subscribedCallback) → {String}
-
Provide a function which will be called whenever the dizmo is maximized (opposite of iconized)
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~iconizedMaximizedCallback The function to call subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Returns:
The subscription id- Type
- String
Example
dizmo.onMaximized(function() { console.log('dizmo is maximized!'); });
-
-
onIconized(callback, subscribedCallback) → {String}
-
Provide a function which will be called whenever the dizmo is iconized
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~iconizedMaximizedCallback The function to call subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Returns:
The subscription id- Type
- String
Example
dizmo.onIconized(function() { console.log('dizmo is iconized!'); });
-
-
onClosing(callback, subscribedCallback) → {String}
-
Provide a function which will be called before the dizmo is closed
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~closingCallback The function to call subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Returns:
The subscription id- Type
- String
Example
dizmo.onClosing(function() { console.log('dizmo is being removed!'); });
-
-
onCancelClosing(callback, subscribedCallback) → {String}
-
Provide a function which will be called when the closing of the dizmo has been canceled.
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~closingCallback The function to call subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Returns:
The subscription id- Type
- String
Example
dizmo.onCancelRemove(function() { console.log('dizmo is not being removed anymore!'); });
-
-
onDragStart(callback, subscribedCallback) → {String}
-
Provide a function which will be called when the dizmo is being dragged
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~dragCallback The function to call subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Returns:
The subscription id- Type
- String
Example
dizmo.onDragStart(function() { var beforeDragX = dizmo.getAttribute('geometry/x'); var beforeDragY = dizmo.getAttribute('geometry/y'); console.log('dizmo will be draged!'); });
-
-
onDragEnd(callback, subscribedCallback) → {String}
-
Provide a function which will be called after the dizmo has been dragged
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~dragCallback The function to call subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Returns:
The subscription id- Type
- String
Example
dizmo.onDragEnd(function() { var afterDragX = dizmo.getAttribute('geometry/x'); var afterDragY = dizmo.getAttribute('geometry/y'); console.log('dizmo has been draged!'); });
-
-
onResizeStart(callback, subscribedCallback) → {String}
-
Provide a function which will be called when the dizmo is being resized
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~resizeCallback The function to call subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Returns:
The subscription id- Type
- String
Example
dizmo.onResizeStart(function() { var beforeResizeWidth = dizmo.getAttribute('geometry/width'); var beforeResizeHeight = dizmo.getAttribute('geometry/height'); console.log('dizmo will be resized!'); });
-
-
onResizeEnd(callback, subscribedCallback) → {String}
-
Provide a function which will be called after the dizmo has been resized
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~resizeCallback The function to call subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Returns:
The subscription id- Type
- String
Example
dizmo.onResizeEnd(function() { var afterResizeWidth = dizmo.getAttribute('geometry/width'); var afterResizeHeight = dizmo.getAttribute('geometry/height'); console.log('dizmo has been resized!'); });
-
-
onShowFront(callback, subscribedCallback) → {String}
-
Provide a function which will be called after the dizmo has been turned to its front side
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~backFrontCallback The function to call subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Returns:
The subscription id- Type
- String
Example
dizmo.onShowFront(function() { jQuery(".front").show(); jQuery(".back").hide(); });
-
-
onShowBack(callback, subscribedCallback) → {String}
-
Provide a function which will be called after the dizmo has been turned to its back side
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~backFrontCallback The function to call subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Throws:
-
If the provided callback is not a function
- Type
- NotAFunctionError
Returns:
The subscription id- Type
- String
Example
dizmo.onShowBack(function() { jQuery(".front").show(); jQuery(".back").hide(); });
-
-
showFront()
-
A call to this function will turn the dizmo to its front side. This function will only initiate the
animation process. It is up to the user to actually change the content of the dizmo to reflect a back
and front side. -
showBack()
-
A call to this function will turn the dizmo to its back side. This function will only initiate the
animation process. It is up to the user to actually change the content of the dizmo to reflect a back
and front side. -
setSize(width, height)
-
Set the size of the dizmo
Parameters:
Name Type Description width
Number The width of the dizmo height
Number The height of the dizmo. Does not include the title bar. Throws:
-
-
If the provided value for width or height is not a number
- Type
- NotANumberError
-
-
-
If the provided value for width is smaller than 65 or bigger than 4000
If the provided value for height is smaller than 50 or bigger than 4000 - Type
- OutOfRangeError
-
-
-
getSize() → {Object}
-
Returns:
The width and height of the dizmo- Type
- Object
-
setPositionAndSize(x, y, width, height)
-
Set the position and size simultaneously
Parameters:
Name Type Description x
Number The x coordinates the dizmo should be moved to y
Number The y coordinates the dizmo should be moved to width
Number The width of the dizmo height
Number The height of the dizmo Throws:
-
-
If the provided value for x, y, width or height is not a number
- Type
- NotANumberError
-
-
-
If the provided value for width is smaller than 65 or bigger than 5400
If the provided value for height is smaller than 50 or bigger than 5400
If the provided value for x is smaller than -3000 or bigger than 3000
If the provided value for y is smaller than -3000 or bigger than 3000 - Type
- OutOfRangeError
-
-
-
getWidth() → {Number}
-
Returns:
The width of the dizmo- Type
- Number
-
getHeight() → {Number}
-
Returns:
The height of the dizmo- Type
- Number
-
setWidth(width)
-
Set the width of the dizmo
Parameters:
Name Type Description width
Number The new width of the dizmo. Must be between 65 and 4000. Throws:
-
-
If the provided value for width or height is not a number
- Type
- NotANumberError
-
-
-
If the provided value is smaller than 65 or bigger than 5400
- Type
- OutOfRangeError
-
-
-
setHeight(height)
-
Set the height of the dizmo. Does not include the title bar.
Parameters:
Name Type Description height
Number The new height of the dizmo. Must be between 50 and 4000. Throws:
-
-
If the provided value for width or height is not a number
- Type
- NotANumberError
-
-
-
If the provided value is smaller than 50 or bigger than 4000
- Type
- OutOfRangeError
-
-
-
focus()
-
Focus the viewer on this dizmos. The viewer zooms in on the dizmo and features it prominentaly in the center.
-
getParentDizmo() → {dizmojs.Dizmo}
-
Returns:
Returns the parent of the dizmo or undefined if no parent exists (i.e.: If the surface is the parent)- Type
- dizmojs.Dizmo
-
setParentDizmo(otherDizmo) → {boolean}
-
Sets the parent dizmo to the provided dizmo if all parenting conditions
are met (see “Controlling other dizmos” in documentation for details). If
`null` or `undefined` is provided, the dizmoViewer surface becomes the parent.Parameters:
Name Type Description otherDizmo
instance to become parent of Returns:
true if successful else false.- Type
- boolean
-
getChildDizmos() → {Array}
-
Returns:
Returns an array of dizmo instances, or an empty array if no child dizmo exists- Type
- Array
-
getRootDizmo() → {dizmojs.Dizmo}
-
Returns:
Returns the root dizmo or undefined if none exists.- Type
- dizmojs.Dizmo
-
getBundle() → {dizmojs.Bundle}
-
Get the bundle associated with this dizmo
Returns:
The bundle instance- Type
- dizmojs.Bundle
-
remoteHostConnected() → {Boolean}
-
Returns:
If a remote host is connected return true, otherwise false- Type
- Boolean
-
getRemoteHost() → {dizmojs.RemoteHost}
-
Get the remote host instance the dizmo is connected to
Returns:
The remote host instance- Type
- dizmojs.RemoteHost
-
onRemoteHostConnected(callback, subscribedCallback) → {String}
-
The provided function will be called whenever a remote host has been connected. Please be aware that only one remote host at a time can be connected.
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~remoteHostConnectedCallback The function to call when a remote host has been connected subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Returns:
The subscription ID to be used in the unsubscribe callback- Type
- String
-
onRemoteHostDisconnected(callback, subscribedCallback) → {String}
-
The provided function will be called whenever a remote host has been disconnected.
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~remoteHostDisconnectedCallback The function to call when a remote host has been disconnected subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Returns:
The subscription ID to be used in the unsubscribe callback- Type
- String
-
unsubscribeRemoteHost(subscriptionId)
-
Unsubscribe from remote host changes
Parameters:
Name Type Description subscriptionId
String The subscription id retrieved from onRemoteHostConnected and onRemoteHostDisconnected. -
getAbsoluteGeometry() → {Object}
-
Retrieve absolute geometry of the dizmo
- Deprecated:
-
- Yes
Returns:
An object with the absolute geometry (in relation to the viewer) of a dizmo
{
zoom: {Number}
x: {Number}
y: {Number}
angle: {Number}
width: {Number}
height: {Number}
}- Type
- Object
-
onParentChanged(callback, subscribedCallback) → {String}
-
The function provided will be called whenever a change in the dizmo’s parent has occurred. If a new parent is being added, the function will receive the dizmo instance of the new parent. If the dizmo’s parent has been removed, i.e. the dizmo has been placed on the viewer directly, undefined will be provided as the parameter.
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~parentChangeCallback The function to call when a change in the parent has occurred. subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Returns:
The subscription ID to be used in unsubscribeParentChange()- Type
- String
-
unsubscribeParentChange(id)
-
Unsubscribe from parent change with the given ID
Parameters:
Name Type Description id
String The subscription ID retrieved from onParentChanged() -
onChildrenAdded(callback, subscribedCallback) → {String}
-
Function to call when a new child has been added. The provided function will receive an array of new dizmo instances.
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~childrenAddedCallback The function to call when a child dizmo has been added subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Returns:
The subscription id to use in unsubscribeChildren()- Type
- String
-
onChildrenRemoved(callback, subscribedCallback) → {string}
-
Function to call when a child dizmo has been removed. The provided function will receive an array of dizmo instances corresponding to the removed dizmos
Parameters:
Name Type Argument Description callback
dizmojs.Dizmo~childrenRemovedCallback The function to call when a dizmo has been removed subscribedCallback
dizmojs.Dizmo~onSubscriptionRegisteredCallback <optional> The function called once the subscription is registered Returns:
The subscription ID to use in unsubscribeChildren()- Type
- string
-
unsubscribeChildren(id)
-
Unsubscribe from any changes to childrens. Use the retrieved ID from onChildrenAdded and onChildrenRemoved
Parameters:
Name Type Description id
String The subscription ID -
share(remoteHostId, callback)
-
Share the dizmo with a remote host.
Parameters:
Name Type Description remoteHostId
String The remote host id (or ip address if remote host id is unknown) callback
function
|undefinedThe function to call upon sharing Throws:
-
-
If the provided remoteHostId is not a string
- Type
- NotAStringError
-
-
-
If the provided callback is not a function (or undefined)
- Type
- NotAFunctionError
-
-
-
If the provided ipv4 or ipv6 address (instead of the remoteHostId) is not correctly formatted
- Type
- InvalidIPAddressError
-
-
-
unshare(remoteHostId, callback)
-
Unshare the shared dizmo with from remote host.
Parameters:
Name Type Description remoteHostId
String ID of remote host callback
function
|undefinedThe function to call upon unsharing Throws:
-
-
If the provided remoteHostId is not a string
- Type
- NotAStringError
-
-
-
If the provided callback is not a function (or undefined)
- Type
- NotAFunctionError
-
-
-
If the provided remoteHostId does not correspond to an existing remote host
- Type
- RemoteHostNotExistsError
-
-
-
clearSetup()
-
Clear the setup if this dizmo has one (mostly for pad dizmos)
Type Definitions
-
attributeChangeCallback(path, newValue, oldValue)
-
A callback that handles changes of attributes
Parameters:
Name Type Description path
String Path of the changed attribute newValue
String The value after the change oldValue
String The value before the change -
menuCallback()
-
A callback that handles clicks on menu items
-
canDockCallback() → {Boolean}
-
Decide whether the dizmo is currently able to dock with another.
Returns:
- Type
- Boolean
-
dockingCallback(dockedDizmo)
-
A callback invoked when a dizmo is docked/undocked with/from another
Parameters:
Name Type Description dockedDizmo
dizmojs.Dizmo The dizmo that has been docked or
undocked to/from the one the
callback has been registered on -
parentChangeCallback(newParent)
-
A callback invoked when a dizmo’s parent changes.
Parameters:
Name Type Description newParent
dizmojs.Dizmo
|undefinedThe new parent (or undefined if none) that the dizmo has. -
childrenAddedCallback(dizmos)
-
A callback invoked when a child dizmo has been added.
Parameters:
Name Type Description dizmos
Array An array of dizmos that have been added as children -
childrenRemovedCallback(dizmos)
-
A callback invoked when a child dizmo has been removed.
Parameters:
Name Type Description dizmos
Array An array of dizmos that have been removed as children from the dizmo. -
showHideCallback()
-
A callback invoked when the dizmo is shown/hidden
-
iconizedMaximizedCallback()
-
A callback invoked when the dizmo is minimized/maximized
-
backFrontCallback()
-
A callback invoked when the dizmo is turned to front/back
-
closingCallback()
-
A callback invoked when the dizmo is closed or the closing is cancelled.
-
dragCallback()
-
A callback invoked when the dizmo starts dragging and when dragging ends.
-
resizeCallback()
-
A callback invoked when the dizmo starts resizing and when resizing ends.
-
remoteHostConnectedCallback(remoteHost)
-
A callback invoked when a remote host has been connected
Parameters:
Name Type Description remoteHost
dizmojs.RemoteHost The connected remote host instance -
remoteHostDisconnectedCallback(remoteHostId)
-
A callback invoked when a remote host has been disconnected
Parameters:
Name Type Description remoteHostId
String The ID of the removed remote host -
onDizmoClonedCallback(dizmoInstance, error)
-
A callback invoked when the dizmo has been cloned or the cloning has failed.
Parameters:
Name Type Description dizmoInstance
dizmojs.Dizmo The dizmo instance of the newly cloned dizmo error
Object An error object containing an error message and an error number -
onSubscriptionRegisteredCallback()
-
A callback that is called as soon as the subscription has been registered in the dizmoViewer.
-
storeBundleInstalledCallback(bundleId, error)
-
A callback invoked when a bundle from the store has been installed.
Parameters:
Name Type Description bundleId
String The bundle id of the installed bundle error
Number An error, if any, that happened when installing the dizmo.
1005|-1005 Unsupported Library
1006|-1006 Unsupported Library
1007|-1007 Wrong dizmoViewer Version