Events reference
Complete reference for all Inline AI SDK events, including enum constants, raw string values, payload shapes, and ready-to-use code snippets for each event.
This page documents every event the Inline AI SDK emits, grouped by category. For each event you'll find the enum constant, its raw string equivalent, a description of when it fires, the shape of the data it delivers to your handler, and a usage example. For a conceptual introduction to the event system (including how on() and off() work), see Reacting to Inline AI events in your page.
Subscribing and unsubscribing
on(event, handler) → unsubscribe
Registers a handler for the given event. Returns a function you can call to remove that specific listener.
// Using the return value to unsubscribe
var unsubscribe = window.InlineAI.on(window.InlineAI.Events.SearchOpen, handler);
unsubscribe(); // removes this listener only| Parameter | Type | Description |
|---|---|---|
event | SDKEventName or Events.* | The event to subscribe to |
handler | function | Called each time the event fires, receives the event payload |
Returns: A zero-argument function that removes this listener when called.
off(event, handler)
Removes a specific handler by reference. You must pass the same function reference that was originally passed to on().
function handler(data) {
console.log(data);
}
window.InlineAI.on(window.InlineAI.Events.SearchOpen, handler);
// Later: must be the same reference
window.InlineAI.off(window.InlineAI.Events.SearchOpen, handler);| Parameter | Type | Description |
|---|---|---|
event | SDKEventName or Events.* | The event to unsubscribe from |
handler | function | The exact function reference passed to on() |
Lifecycle events
Lifecycle events tell you when the SDK is initialized and when publisher configuration has finished loading from the API.
Placement events
Placement events fire each time a placement is added to or removed from the page, whether by auto mode, programmatic mount() calls, or unmount().
Search events
Search events fire when the search overlay opens or closes. Use them to track search activity or synchronize your own UI.
Widget events
Widget events fire when the sticky Widget panel opens or closes.
All events at a glance
| Enum constant | Raw string | Payload | When it fires |
|---|---|---|---|
Events.Ready | 'ready' | none | SDK initialized; ready for mount() calls |
Events.ConfigLoad | 'config:loaded' | none | Publisher page config loaded from API |
Events.PlacementMount | 'placement:mounted' | { id, type, container } | A placement was added to the DOM |
Events.PlacementUnmount | 'placement:unmounted' | { id, type } | A placement was removed from the DOM |
Events.SearchOpen | 'search:open' | { query } | Search overlay opened |
Events.SearchClose | 'search:close' | { method } | Search overlay closed |
Events.WidgetOpen | 'widget:open' | none | Sticky widget panel opened |
Events.WidgetClose | 'widget:close' | none | Sticky widget panel closed |
TypeScript type reference
If you're using TypeScript, the SDKEventName union type covers all valid event name strings:
type SDKEventName =
| "ready"
| "config:loaded"
| "placement:mounted"
| "placement:unmounted"
| "search:open"
| "search:close"
| "widget:open"
| "widget:close";