# Interface: FidesEvent

FidesJS dispatches a variety of lifecycle events to the global `window`, making it easy to subscribe to an event stream to keep your application updated in real-time. Each of these events extends the standard [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent) interface and includes a [detail](/content/docs/privacy-center-fidesjs/fidesjs/reference/interfaces/FidesEvent#detail/index.html) object with various properties that can be used for inspecting current consent preferences, generating analytics, etc.

## Example

```javascript
window.addEventListener("FidesUpdated", (evt) => {
  console.log("Received 'FidesUpdated' event! Current consent preferences: ", evt.detail.consent);
});
```

See the list below for information on what events are dispatched (and when!) and the [detail](/content/docs/privacy-center-fidesjs/fidesjs/reference/interfaces/FidesEvent#detail/index.html) reference for the available properties.

### List of FidesEvent Types

- `FidesInitializing`: Dispatched when initialization begins, which happens immediately once the FidesJS script is loaded. If `Fides.init()` is called multiple times, this event will also be dispatched each time.
- `FidesConsentLoaded`: If previously saved consent was found during initialization, we immediately set it on the `Fides` global object and dispatch this event. This event will only be dispatched if consent was found.
- `FidesReady`: Dispatched when initialization is complete and the current user's consent preferences - either previously saved or applicable defaults - have been set on the `Fides` global object. This event will always be dispatched, even if no previous consent was found.
- `FidesInitialized`: This event is dispatched based on the `fidesInitializedEventMode` setting. It has three possible modes: "once" (default), "multiple", and "disable".
- `FidesUpdating`: Dispatched when a user action (e.g., accepting all, saving changes, applying GPC) has started updating the user's consent preferences. This event is dispatched immediately once the changes are made, but before they are saved.
- `FidesUpdated`: Dispatched when a user action has finished updating the user's consent preferences. This event is dispatched once the changes are fully saved.
- `FidesUIShown`: Dispatched whenever a FidesJS UI component is rendered and shown to the current user (banner, modal, etc.). The specific component shown can be obtained from the `detail.extraDetails.servingComponent` property on the event.
- `FidesUIChanged`: Dispatched whenever the current user changes their preferences in the FidesJS UI but has yet to save those changes.
- `FidesModalClosed`: Dispatched whenever the FidesJS modal is closed.

### Properties

#### detail

> **detail**: `object`

Event properties passed by FidesJS when dispatched. Depending on the event type, some properties may or may not be set, so most of these are marked as optional.

- **consent**: `Record<string, boolean>`  User's current consent preferences.
- **fides_string?**: `string`  User's current consent string.
- **timestamp?**: `number`  High-precision timestamp representing when this event was created.
- **extraDetails?**: `object`
  - **servingComponent?**: `
