---
schema_version: "1"
id: 0673b84c3e38affca8d19497dbd5e7b76a29dc70804c82eb671073a2e394ae88
title: Tableau JavaScript API Concepts--Events
collection: tableau
version: current
locale: en-us
portal_url: https://docs.salesforce.com/tableau/current/en-us/api/js_api/JavaScriptAPI/js_api_concepts_events.md
canonical_url: https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_concepts_events.htm
source_site: help.tableau.com
content_type: documentation
content_hash: 2806ecc46d2773a9393eef9bf708fd5320fb2795da65f2b30e40bb1df4456d35
description: Important changes for the Tableau JavaScript API
---
[Skip to main content](#main-content)

# Events

**Important changes for the Tableau JavaScript API**

As of February 2024, the Tableau JavaScript API is deprecated. Use the Embedding API v3 instead for embedding interactive views into web pages and applications. For guidance on embedding Tableau views, see the [Tableau Embedding API v3 Help](https://help.tableau.com/current/api/embedding_api/en-us/index.html).

The `Viz` class acts as the central event hub. This way you only have to go to one place for all events. It also means that events can be raised on an object that may not have been created yet. For example, the `marksselection` event can be raised for a particular sheet even though the `Sheet` object hasn't been created yet. Each event contains an anonymous object with information pertaining to that event, such as the sheet the event occurred on.

Listening to an event is done by calling `Viz.addEventListener(type, callback)` and passing in a function callback. Here's an example of listening to an event:

```
viz.addEventListener("marksSelection", function (marks) {
   changeMySelectionUI(marks);
});
```

Removing a listener is done by calling `Viz.removeEventListener(type, listener)` and passing in the same callback function that was passed into `Viz.addEventListener()`. For example:

```
function changeMySelectionUI(marks) {
   viz.removeEventListener("marksSelection", changeMySelectionUI);
}
viz.addEventListener("marksSelection", changeMySelectionUI);
```

Events are multicast delegates, meaning that multiple listeners are supported. The order in which notifications are called is not specified. Every event callback takes a single object containing a pointer to the `Viz` that raised the event. Each event also adds additional fields to the event, as specified in the [API Reference](https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_ref.htm).