# CreatorAPI.on
Registers an event listener for events

{/* Do not edit this file. It is automatically generated by API Documenter. */}

## CreatorAPI.on() method

Registers an event listener for events

**Signature:**

```typescript
on<T extends CreatorEventName>(type: T, callback: (data: CreatorEventData<T>) => void): void;
```

## Parameters

<table>
  <thead>
    <tr>
      <th>
        Parameter
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        type
      </td>

      <td>
        T
      </td>

      <td>
        The event type to listen for
      </td>
    </tr>

    <tr>
      <td>
        callback
      </td>

      <td>
        (data: [CreatorEventData](/en/creator-api/types/creator-event-data)\<T>) => void
      </td>

      <td>
        Function called when the event fires
      </td>
    </tr>
  </tbody>
</table>

**Returns:**

void

## Example

```ts
creator.on("selection:nodes", callback);
```
