Skip to main content

Overview

The event system lets you react to presentation lifecycle events like shown, dismissed, and converted. Events flow through event handlers that you register with Presentum. Each handler can perform actions like recording to storage, sending analytics, or triggering business logic.

Built-in events

Presentum provides three core events:

PresentumShownEvent

Fired when a presentation is displayed to the user

PresentumDismissedEvent

Fired when a user dismisses a presentation

PresentumConvertedEvent

Fired when a user takes action on a presentation

Event structure

All events extend PresentumEvent and include:

PresentumShownEvent

PresentumDismissedEvent

PresentumConvertedEvent

Event handlers

Create handlers by implementing IPresentumEventHandler:

Built-in storage handler

PresentumStorageEventHandler automatically records events to storage:

Register handlers

Add handlers when creating Presentum:
Handlers run in order. Each receives the same event.

Trigger events

Events are automatically triggered when you call:

Custom events

Create your own events by extending PresentumEvent:

Production example

Here’s a complete event handling setup from a production app:

Event handler patterns

Logging handler

Backend sync handler

BLoC integration handler

Best practices

Event handlers run synchronously. Avoid slow operations.Bad:
Good:
Always include the storage handler to record events:

Next steps

Transition observers

React to state changes

Storage

Implement storage interface

Analytics recipe

Complete analytics integration