> For the complete documentation index, see [llms.txt](https://developers.memberspace.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.memberspace.com/javascript-api/overview/events.md). Agents can also search and read this documentation through its [MCP server](https://developers.memberspace.com/~gitbook/mcp).

# Events

You can listen for events and run custom code. We will dispatch a series of Custom Events based on lifecycle events and actions the member may take.

{% hint style="warning" %}
To eliminate any chance of [events](https://developers.memberspace.com/javascript-api/overview/events.md) being fired before the appropriate listeners have been added, listeners should be registered before the [install code](https://developers.memberspace.com/getting-started/install-code.md) is run. If this is not possible or impractical, please implement a code based on [this](https://developers.memberspace.com/javascript-api/guides/member-info-spa.md#single-page-apps) guide.
{% endhint %}
