# Mixin: Dispatcher

## Core.Actions. Dispatcher

Creates a dispatcher. A mixin that enables many different classes to construct and dispatch PDF Actions.

### Methods

#### addAction(trigger, action [, replace])

  Add a single action to a trigger.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `trigger` | string |  | The name of the trigger to which to add the action.
  `action` | Core.Actions.Action | object |  | The action to add, or an object representing the desired properties (including a name)
  `replace` | boolean | <optional> | True if existing actions should be replaced

#### addActions(actions)

  Add the actions to the dispatcher so they run on next trigger, constructing them if necessary

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `actions` | object | The actions to add, as an object with triggers for keys and arrays of action-describing objects for values.

#### getActions()

  Get all the actions associated with this dispatcher.

  ##### Returns:

  The associated actions (in the same format as addActions)
  Type
    object

#### getDocumentViewer()

  Get the associated DocumentViewer.

  ##### Returns:

  The associated DocumentViewer instance
  Type
    Core.DocumentViewer

#### setDocumentViewer(documentViewer)

  Set the internal DocumentViewer reference, which is required for some actions to execute correctly.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `documentViewer` | Core.DocumentViewer | The DocumentViewer instance

#### Search results