---
title: "Evented | Geosplats sdk"
description: "Documentation for MapTiler GeoSplats SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs-qmgv.pages.dev/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Class Evented<E>`Abstract`

Abstract class that provides event handling capabilities.

#### Type Parameters

-   E extends [Event](https://docs-qmgv.pages.dev/geosplats-sdk/api/interfaces/Event/)<string\>

#### Hierarchy ([View Summary](https://docs-qmgv.pages.dev/geosplats-sdk/api/hierarchy/#Evented))

-   Evented
    -   [SplatModel](https://docs-qmgv.pages.dev/geosplats-sdk/api/classes/SplatModel/)
    -   [Map](https://docs-qmgv.pages.dev/geosplats-sdk/api/classes/Map/)

##### Index

### Constructors[](#constructors)

[constructor](#constructor)

### Properties[](#properties)

[loaded](#loaded)

### Methods[](#methods)

[off](#off) [on](#on) [once](#once)

## Constructors[](#constructors-1)

### constructor[](#constructor)

-   new Evented<[E](#constructoreventede) extends [Event](https://docs-qmgv.pages.dev/geosplats-sdk/api/interfaces/Event/)<string\>\>(): Evented<[E](#e)\>[](#constructorevented)
    
    #### Type Parameters
    
    -   E extends [Event](https://docs-qmgv.pages.dev/geosplats-sdk/api/interfaces/Event/)<string\>
    
    #### Returns Evented<[E](#e)\>
    

## Properties[](#properties-1)

### `Protected`loaded[](#loaded)

loaded: boolean = false

## Methods[](#methods-1)

### off[](#off)

-   off<[EventType](#offeventtype) extends string\>(  
        eventType: [EventType](#offeventtype),  
        handler: (event: Extract<[E](#e), { type: [EventType](#offeventtype) }\>) \=> void,  
    ): void[](#off-1)
    
    Removes a listener for a specific event type.
    
    #### Type Parameters
    
    -   EventType extends string
    
    #### Parameters
    
    -   eventType: [EventType](#offeventtype)
        
        The type of event to remove the listener from.
        
    -   handler: (event: Extract<[E](#e), { type: [EventType](#offeventtype) }\>) \=> void
        
        The listener function to remove.
        
    
    #### Returns void
    

### on[](#on)

-   on<[EventType](#oneventtype) extends string\>(  
        eventType: [EventType](#oneventtype),  
        handler: (event: Extract<[E](#e), { type: [EventType](#oneventtype) }\>) \=> void,  
    ): void[](#on-1)
    
    Adds a listener for a specific event type.
    
    #### Type Parameters
    
    -   EventType extends string
    
    #### Parameters
    
    -   eventType: [EventType](#oneventtype)
        
        The type of event to listen for.
        
    -   handler: (event: Extract<[E](#e), { type: [EventType](#oneventtype) }\>) \=> void
        
        The function to call when the event is fired.
        
    
    #### Returns void
    
    #### Example[](#example)
    
    ```typescript
    map.on('load', () => {
      console.log('Map loaded!');
    });
    ```
    

### once[](#once)

-   once<[EventType](#onceeventtype) extends string\>(  
        eventType: [EventType](#onceeventtype),  
        handler: (event: Extract<[E](#e), { type: [EventType](#onceeventtype) }\>) \=> void,  
    ): void[](#once-1)
    
    Adds a listener for a specific event type that will be called only once.
    
    #### Type Parameters
    
    -   EventType extends string
    
    #### Parameters
    
    -   eventType: [EventType](#onceeventtype)
        
        The type of event to listen for.
        
    -   handler: (event: Extract<[E](#e), { type: [EventType](#onceeventtype) }\>) \=> void
        
        The function to call when the event is fired.
        
    
    #### Returns void
    
    #### Example[](#example-1)
    
    ```typescript
    map.once('splatmodel:load', () => {
      console.log('First SplatModel loaded!');
    });
    ```
