Skip to main content
$sleek.on() lets you register callbacks that fire whenever the widget emits a lifecycle or authentication event — for example, when the widget opens, when a user navigates to a new screen, or when authentication completes. If you need to attach a listener before the $sleek object is available, you can also use document.addEventListener with the sleek: prefix on any event name.

Register a listener

Call $sleek.on(action, callback) to register a function that runs whenever the specified event fires.
body.action
string
required
The name of the event to listen for. See the event reference below for all available event names.
body.callback
function
A function to execute when the event fires. Some events pass a return value as the first argument — see the event table for details.

Listen before the SDK loads

If you need to attach a listener before the $sleek object is available — for example, in a script that runs earlier than the SDK — use the native document.addEventListener API with the sleek: prefix on the event name.
The sleek:eventname pattern mirrors every event in the table below. Replace eventname with the exact event name — for example, sleek:open, sleek:user_auth_completed.

Event reference

Code examples

Track widget open and close

React to navigation changes

Handle authentication events

Wait for the widget to be ready

Listen before the SDK script loads