Skip to main content

Controlling UI using Javascript API

The RealtyVis Javascript API allows web developers to programmatically control UI block components with custom interactions.

Getting started

Before using the RealtyVis Javascript API, ensure the embed Javascript is included in your webpage HTML.

Methods

// Returns true is user is authenticated, otherwise false
realtyvis.isAuthenticated();

// Opens the user sign-in form
realtyvis.login();

// Sign-out the current user
realtyvis.logout();

// Opens the create account form
realtyvis.register();

// Opens the user favourited listings if user is signed-in,
// otherwise opens the create account form
realtyvis.openFavourites();

// Opens the user saved searches if user is signed-in,
// otherwise opens the create account form
realtyvis.openSavedSearches();

// Opens the user profile information if user is signed-in,
// otherwise opens the create account form
realtyvis.openProfile();

Events

EventDescription
realtyvis:initializedFired right after RealtyVis initialization.

Example

The following is an example of how to create a custom HTML button that opens the favourites dialog when the user clicks on the button.

<button type="button" id="btnFavourites">My Favourites</button>
<script>
document.addEventListener('realtyvis:initialized', () => {
document.getElementById('btnFavourites').addEventListener('click', () => {
realtyvis.openFavourites();
});
});
</script>