# Event Manager
URL: https://pro.rv-grid.com/api/event-manager/
Source: src/content/docs/api/event-manager.md
## Module Extensions

### `AdditionalData` (Extended from `@revolist/revogrid`)

```ts
interface AdditionalData {
  /**
       * Additional data property for event manager
       * @deprecated Use `grid.eventManager` instead.
       *
       * @example
       * ```typescript
       * const grid = document.createElement('revo-grid');
       * grid.additionalData = { eventManager: { collectEvents: true, collectEventsDelay: 1000 } };
       * ```
       */
      eventManager?: EventManagerConfig
}
```

---

### `HTMLRevoGridElement` (Extended from `global`)

```ts
interface HTMLRevoGridElement {
  /**
       * Direct event manager configuration.
       */
      eventManager?: EventManagerConfig
}
```

---

### `HTMLRevoGridElementEventMap` (Extended from `global`)

```ts
interface HTMLRevoGridElementEventMap {
  /**
       * Event for event manager
       *
       * @example
       * ```typescript
       * grid.addEventListener(ON_EDIT_EVENT, (event) => {
       *   console.log(event);
       * });
       * ```
       */
      [ON_EDIT_EVENT]: EventManagerEvent
}
```

## Plugin API

### `EventManagerPlugin`

RevoGrid Plugin for Event Manager.
Whole purpose is to collect and dispatch edit events in one place.

```ts
class EventManagerPlugin {}
```

---

### `EventManagerEvent` (Extended from `index.ts`)

```ts
export type EventManagerEvent = {
  eventTypes: string[];
  previousData: BeforeRangeSaveDataDetails['data'];
} & Omit<BeforeRangeSaveDataDetails, 'newRange' | 'oldRange'>;
```

---

### `EventManagerConfig`

The configuration object for the EventManagerPlugin.

```ts
/**
 * The configuration object for the EventManagerPlugin.
 */
export type EventManagerConfig = {
  /**
   * Whether to collect events and apply delay or send them immediately.
   * @default false
   */
  collectEvents?: boolean;

  /**
   * The delay in milliseconds to wait until the
   * collected events are applied to the grid.
   * Used only when `collectEvents` is true.
   * @default 0
   */
  collectEventsDelay?: number;

  /**
   * Whether to apply the collected events to the
   * original data source.
   * @default true
   */
  applyEventsToSource?: boolean;
};
```
