Your listener id (must be unique for all user events)
Your listener function
// Each time the session has changed this method is processed
JMap.Event.User.on.sessionChanged(
"custom-session-change",
params => {
if (params.session.accessToken === "-1") {
console.log("Session has been closed", params.session)
} else {
console.log(`New session opened`, params.session)
}
}
)
JMap.Event.User.on.sessionChanged
This event is triggered when the user session has changed.
If it's a logout, the accessToken in params.session is equal to "-1".