# Class: OnMouseEventCmd

## OnMouseEventCmd(alwaysConsumeEvent)

The abstract base class of all local commands bound to a mouse event.

## Constructor

#### new OnMouseEventCmd(alwaysConsumeEvent)

Constructor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`alwaysConsumeEvent` | boolean | if `true`, the mouse event which triggers this command will be automatically be consumed.

Source:
  - cmd/OnMouseEventCmd.js, line 12

### Classes

OnMouseEventCmd

### Methods

#### canExecuteImpl(docView, params, event) → {boolean}

Invoked by `OnMouseEventCmd` redefinition of Command.execute when execution mode is Command.EXECUTE_TEST.

May be redefined by subclass. Default implementation always returns `true`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`docView` | DocumentView | the target of this command.
`params` | string | parameterizes the command. May be `null`.
`event` | UIEvent | the mouse event which triggered this command.

Source:
  - cmd/OnMouseEventCmd.js, line 88

##### Returns:

`true` if the command can be executed, `false` otherwise.

Type
  boolean

#### executeImpl(docView, params, event) → {Promise}

Invoked by `OnMouseEventCmd` redefinition of Command.execute when execution mode is Command.EXECUTE_NORMAL or Command.EXECUTE_HELPER.

Must be redefined by subclass. Default implementation returns a `Promise` containing CommandResult.FAILED).

##### Parameters:

Name | Type | Description
--- | --- | ---
`docView` | DocumentView | the target of this command.
`params` | string | parameterizes the command. May be `null`.
`event` | UIEvent | the mouse event which triggered this command.

Source:
  - cmd/OnMouseEventCmd.js, line 62

##### Returns:

A Promise containing CommandResult or `null` if, for any reason, this command has not been executed.

Type
  Promise