# Events

Events are fired by `Tebex.portal` upon specific actions to alert your frontend and enable you to take action when required.

To add a portal event callback, use `Tebex.portal.on()` . The first argument to this function should be the name of the event to listen to, and the second argument should be a function to call when that event is fired:

```javascript
Tebex.portal.on("close", () => {
    console.log("Portal popup was closed");
});
```

Available events are as follows:

<table><thead><tr><th width="175.32421875">Name</th><th>Fired Upon</th></tr></thead><tbody><tr><td><code>"open"</code></td><td>The portal popup opening after calling <code>Tebex.portal.launch().</code></td></tr><tr><td><code>"close"</code></td><td>The portal popup closing after being dismissed by the user.</td></tr></tbody></table>
