Skip to content

ToolStateManager API

chafey edited this page Mar 25, 2014 · 1 revision

ToolStateManagers expose their API through a javascript object with the following functions in it:


The get function is called by a tool to get tool data for a specific element and tool type.

function get(element, toolType);

Parameters:

  • element - the DOM element to enable
  • toolType - a unique string identifying this tool data. This needs to be unique to avoid conflicts with other tools so consider using a GUID, project name or other strings as part of the toolType.

Returns: A javascript object containing the tool data or undefined if there is no associated tool data


The set function is called by a tool to set tool data for a specific element and tool type.

function set(element, toolType, data);

Parameters:

  • element - the DOM element to enable
  • toolType - a unique string identifying this tool data. This needs to be unique to avoid conflicts with other tools so consider using a GUID, project name or other strings as part of the toolType.
  • data - a javascript object containing the tool data

Returns: nothing