Storyboard Javascript API
Storyboard Javascript API Documentation.
sb.addEventListener
Add an event listener that will invoke a callback with the standard context object as its first argument. The target option can be used to specify a model object to listen on, if it is not present the listener will be created at the application level.
sb.animationAddStep
Add a step to a created animation. The id must be from a call toΒ sb.animationCreate. The stepData parameter defines the animation step values. NOTE: If both "to" and "delta" are given then the "to" value is used.
sb.animationCreate
Create a new animation at the desired frame rate (fps). The second parameter (optional), auto_destroy, tells if the animation should be released once completed. If you specify a value of 1 the animation will be released and the returned id is not valid once the animation has completed. The third parameter (optional) indicates a callback function to be invoked when the animation is complete.
sb.animationCreateTween
Create a new animation tweening (interpolation) function that can be used by both JavaScript and Animation Timeline animations. The name of the tweening function cannot collide with any existing animation tweening names. The callback function is a generic tween function that will be provided with specific parameters outlining the desired range of the values being tweend and the frame at which the values should be interpolated.
sb.animationDestroy
Destroy the animation associated with id.
sb.animationGetState
Get the current state of an animation. Possible states are:
sb.animationPause
Pause a running animation. If an animationID is used to pause the animation, then it must be the return value from sb.animationCreate(). If a name is used to pause an animation, then that name must be the name of the animation specified in Designer. This function can take an optional parameter, data. The data parameter is an object that contains variables for the extra arguments to set.
sb.animationResume
Pause a running animation. If an animationID is used to pause the animation, then it must be the return value from sb.animationCreate(). If a name is used to pause an animation, then that name must be the name of the animation specified in Designer. This function can take an optional parameter, data. The data parameter is an object that contains variables for the extra arguments to set.
sb.animationStop
Stop an animation. If an animationID is used to stop the animation, then it must be the return value from sb.animationCreate(). If a name is used to stop an animation, then that name must be the name of the animation specified in Designer. This function can take an optional parameter, data. The data parameter is an object that contains variables for the extra arguments to set.
sb.animationTrigger
Trigger an animation to run. If an animation\_id is used to trigger the animation, then it must be the return value from sb.animationCreate(). If a name is used to trigger an animation, then that name must be the name of the animation specified in Designer. This function can take an optional parameter, data. The data parameter is an object that contains the variables for the extra arguments to set.
sb.APP_ROOT
This is a variable that is filled in by the Storyboard Engine to point at the filesystem path for the application's project root directory. This can be used in order to access resources in a project-relative manner. This variable is only applicable for filesystem-based configurations.
sb.cloneObject
Create a new control, table or group (newObjectName) within an existing parent (parentName) by copying all of the properties of an existing object (referenceObjectName). This new object will have all of the same actions, variables and it's current state will match the state of the reference object that is being copied. In the case of cloning groups, all of the reference group's controls will be cloned into the new group. Currently only controls and groups are supported as source reference objects.
sb.deleteObject
Delete an object that has been cloned using sb.cloneObject from the model. The object must be a control, a table, or a group.
sb.env
Return information about the Storyboard runtime environment. The input is one or more strings that match the key to look up. The following table describes the available keys:
sb.getControlAttrs
Get properties for a control. Key name is the name of the control or a variable. Tags can be a list of the following values: x, y, width, height, hidden, active, zindex, findex, mask_enabled.
sb.getData
Gets one or more values from the data manager. Each argument to the function is interpreted as a data manager key whose value should be extracted from the data manager. This function returns an object using all the values as indexes and the corresponding value is the data returned from the data manager. A null value is returned for any values that do not match a key in the data manager.
sb.getGroupAttrs
Get properties for a group. Key name is the name of the group or a variable. Tags can be a list of the following values:
sb.getLayerAttrs
Get properties for a layer instance associated with a particular screen.
sb.getStringSize
Calculate the area in pixels which the given string will occupy on the screen.
sb.getTableAttrs
Get properties for a table. The key name is the name of the control or a variable. Tags can be any of the control tags and any of the following values:
sb.getTableCellAttrs
Get properties for a table cell. table\_name is the name of the table. Tags can be a list of the following values:
sb.getValue
Get the value of a variable from the data manager. A nil is returned for any values that do not match a key in the data manager.
sb.greioDisconnect
This function forces any cached Storyboard IO channel connections to the specified channel to be closed. Subsequent calls using the same channel name will re-establish the connection to the channel if required.
sb.polyString
This is a higher performance function for generating a polygon string based on a set of numeric data points maintained in JS arrays.In the two argument form, the function receives as inputs two JS arrays whose content represents the numeric x and y data points to be converted to a string.In the single argument form, the function receives as input a single JS array whose content are objects with an "x" and "y" member values.The string returned is designed to be compatible with the Storyboard polygon plugin and is in the form of X1Y2 ...
sb.quit
Send QUIT event to application to force shutdown. channel is an optional parameter.
sb.receiveEvent
Receive an event from a Storyboard IO channel. This is a blocking call so the UI may become unresponsive when used if it takes a while for the event to be received.
sb.redraw
Force a screen redraw. channel is an optional parameter. Specifying a x,y,width,height of 0 will result in a full screen refresh occurring.
sb.removeEventListener
Remove an event listener created with sb.addEventListener.
sb.resolveDataKey
This function allows JS scripts to resolve Storyboard context variables to a fully qualified name based on the current execution context.
sb.SCRIPT_ROOT
This is a variable that is filled in by the Storyboard Engine to contain the path to the application project's scripts directory. The sb.SCRIPT_ROOT variable provides a convenient way to reference the JavaScript-related resources in a location-independent, project relative, manner.
sb.sendEvent
Send an event to the application or to a Storyboard IO channel. channel is an optional parameter and if channel is not passed then the channel will be chosen as follows:
sb.setControlAttrs
Set properties for a control. The controlName is the name of the control or a variable. The tagObject contains the tags and values for the properties to set.
sb.setData
Sets one or more items in the Storyboard application's data manager. Each key and value in the object passed in will be set in the data manager using the key name as the key.
sb.setGroupAttrs
Set properties for a group. The groupName is the name of the group or a variable. The tagObject contains the tags and values for the properties to set.
sb.setLayerAttrs
Set properties for a layer instance associated with a particular screen. The layerName specifies either the fully qualified name of a layer instance using the ScreenName.LayerName naming convention or, if only the layer name is specified, the name will refer to a layer instance associated with the current screen
sb.setLayerAttrsGlobal
Set properties for a layer globally on all instances of the layer on all screens. The layerName is the name of the layer. The tagObject contains the tags and values for the properties to set.
sb.setTableAttrs
Set properties for a table. The tableName is the name of the control or a variable. The tagObject contains the tags and values for the properties to set.
sb.setTableCellAttrs
Set attributes for a table cell. This can only be applied for single column or single row tables and the parameters that can be modified are restricted in each case:
sb.setTableTemplateAttrs
Set attributes for a table column template. This will result in the template being changed and the entire table being re-laid out and re-configured. If any changes were made to specific cells then those changes will be lost and need to be re-applied.The tagObject contains tags and values for the attributes to set:
sb.setValue
Set a variable in the data manager to a particular value.
sb.setValues
Set a variable in the data manager to a particular value.
sb.timerClearInterval
This function stops an existing timer from firing.
sb.timerClearTimeout
This function stops an existing timer from firing.
sb.timerSetInterval
This function creates a repeating timer which fires every "interval" milliseconds and then executes "function"
sb.timerSetTimeout
This function creates a one-shot timer that fires after timeout milliseconds and then executes function