Appearance
Listen for configurator events
Use api.events.on() for repeated events and api.events.once() for the next matching event. Both return an unsubscribe function that is cleaned up automatically when the plugin is disposed.
ts
setup(api) {
api.events.on('wheel:selected', (event) => {
console.log(event.timestamp)
console.log(event.data.source)
console.log(event.data.wheel)
})
}Track route changes
ts
api.events.on('route:changed', (event) => {
const { from, to } = event.data
console.log(`${from.fullPath} → ${to.fullPath}`)
})Send data to a host integration
Plugins can translate product events into a customer-owned browser event:
ts
api.events.on('wheel:viewed', (event) => {
window.dispatchEvent(
new CustomEvent('dealer:wheel-viewed', {
detail: {
wheelImageId: event.data.wheelImageId,
},
}),
)
})Do not retain or mutate event data. Treat payloads as read-only observations of a completed configurator action. Use a hook when the application offers an approved transformation point.
See the events reference for supported names and payloads.