๐ข Javascript Events
When the library is properly loaded, it fires certain events to ease your workflow. Keep in mind that the widget can creating a JavaScript variable named window.cxpm.jQuery with the required version of jQuery. Outside the "comexposiumConnectLoaded" event, all events are triggered with window.cxpm.jQuery.
comexposiumConnectLoaded
When the library is fully loaded, an event is triggered to inform you that everything is ready. You can listen to your custom events from the moment when the widget is ready, this event will be triggered from the global scope jQuery ($ or jQuery):
$(document).on("comexposiumConnectLoaded", function(){
Execute something
window.cxpm.jQuery(document).on("MON_EVENEMENT",function(){
Listen to a personalized event
});
});
comexposiumConnectLogged
This event is triggered when the user is connected in SSO to ComexposiumConnect. This can happen when the page is loaded (the user is already connected to the system) or when submitting the login form:
$(document).on("comexposiumConnectLogged", function(){
Execute something
});
comexposiumConnectLogout
This event is triggered when the user is disconnected. This can happen when the user has been disconnected in an other tab, or in an other application:
window.cxpm.jQuery(document).on('comexposiumConnectLogout', () => {
Execute something
});
comexposiumConnectRegisterOk
This event indicates that the user closed the interface after creating an account. The callback can take 2 parameters, the event and the e-mail address used to create the account:
window.cxpm.jQuery(document).on("comexposiumConnectRegisterOk", function(event, email){
An account has been created and we can get the email
});
comexposiumConnectTokenExpired
This event is triggered when the token expired. Remember that the JWT token has a validated date. See option "expireIn" on the login API.
The expiration of the token implies an automatic disconnection but does not trigger the comexposiumConnectLogout event.
window.cxpm.jQuery(document).on('comexposiumConnectTokenExpired', () => {
Execute something
});