Custom events dispatched on window. Access data via event.detail.
| Event | Detail | When |
|---|---|---|
rechat-listings:fetched |
IListing[] |
Listings loaded/reloaded from API |
rechat-listing-filters:change |
Filter state object | Any filter or map position changes |
rechat-listing-card:click |
{ listing: IListing } |
Listing card clicked. Fires for cards inside the grid/list and for listings picked from the address-search autocomplete's "Listings" section |
rechat-listings-pagination:change |
{ page: number } |
Page changed |
rechat-listing-details:open |
{ listing_id: string } |
A listing's details modal is requested |
rechat-property-search-form:submit |
submitted search values | The standalone search form is submitted |
rechat-login:success |
{ token, provider } |
A visitor signed in (portal sites) |
rechat-logout |
- | A visitor signed out (portal sites). Every widget on the page reloads its session on both events, so several widgets stay in step |
rechat-saved-search:created |
the saved search | A visitor saved a search (portal sites) |
rechat-agents:fetched |
IUser[] |
An agent roster page loaded (Agents) |
rechat-agents-pagination:change |
{ page: number } |
The agent roster page changed |
rechat-agent-card:click |
{ agent: IUser } |
An agent card was clicked |
rechat-testimonials:fetched |
ITestimonial[] |
A page of testimonials loaded; the detail holds that page only, not the ones already shown (Testimonials) |
rechat-error |
{ source: string, error: string } |
API request failed. source names the feature, e.g. listings, agents or testimonials |
window.addEventListener('rechat-listings:fetched', (e) => {
console.log(`${e.detail.length} listings loaded`)
})
window.addEventListener('rechat-listing-card:click', (e) => {
// Fires for listing-grid clicks AND for picks from the address-search
// autocomplete's "Listings" section.
window.location.href = `/properties/${e.detail.listing.id}`
})
window.addEventListener('rechat-error', (e) => {
console.error(`[${e.detail.source}]:`, e.detail.error)
})