JSDoc: Class: Chain

# Class: Chain

## action.Chain()

Represents a series of ticks, specifying which actions to perform at each tick.

## Constructor

#### new Chain()

Source:
  - action.js, line 754

### Methods

#### (static) fromJSON(actions) → {action.Chain}

##### Parameters:

Name | Type | Description
--- | --- | ---
`actions` | Array.<?> | Array of objects that each represent an action sequence.

Source:
  - action.js, line 770

##### Throws:

If actions is not an Array.

Type
  InvalidArgumentError

##### Returns:

Transpose of actions such that actions to be performed in a single tick are grouped together.

Type
  action.Chain

#### actions(chain, touchId, i, keyModifiers, cb) → {Object.<string, number>}

Emit events for each action in the provided chain.

To emit touch events for each finger, one might send a [["press", id], ["wait", 5], ["release"]] chain.

##### Parameters:

Name | Type | Description
--- | --- | ---
`chain` | Array.<Array.<?>> | A multi-dimensional array of actions.
`touchId` | Object.<string, number> | Represents the finger ID.
`i` | number | Keeps track of the current action of the chain.
`keyModifiers` | Object.<string, boolean> | Keeps track of keyDown/keyUp pairs through an action chain.
`cb` | function | Called on success.

Source:
  - legacyaction.js, line 172

##### Returns:

Last finger ID, or an empty object.

Type
  Object.<string, number>

#### emitMouseEvent(doc, type, clickCount, elClientX, elClientY, modifiers)

This function emit mouse event.

##### Parameters:

Name | Type | Description
--- | --- | ---
`doc` | Document | Current document.
`type` | string | Type of event to dispatch.
`clickCount` | number | Number of clicks, button notes the mouse button.
`elClientX` | number | X coordinate of the mouse relative to the viewport.
`elClientY` | number | Y coordinate of the mouse relative to the viewport.
`modifiers` | Object | An object of modifier keys present.

Source:
  - legacyaction.js, line 103

#### generateEvents(x, y)

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | number | X coordinate of the location to generate the event that is relative to the viewport.
`y` | number | Y coordinate of the location to generate the event that is relative to the viewport.

Source:
  - legacyaction.js, line 342

#### getCoordinateInfo()

Given an element and a pair of coordinates, returns an array of the form [clientX, clientY, pageX, pageY, screenX, screenY].

Source:
  - legacyaction.js, line 322

#### resetValues()

Reset any persisted values after a command completes.

Source:
  - legacyaction.js, line 145