Methods
# onSessionCreated(callback, onceopt) → {CleanupFunc}
Adds an event listener for "hanko-session-created" events. Will be triggered across all browser windows, when the user
logs in, or when the page has been loaded or refreshed and there is a valid session.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
CallbackFunc.<SessionDetail>
|
The function to be called when the event is triggered. | |
once |
boolean
|
<optional> |
Whether the event listener should be removed after being called once. |
This function can be called to remove the event listener.
# onSessionExpired(callback, onceopt) → {CleanupFunc}
Adds an event listener for "hanko-session-expired" events. The event will be triggered across all browser windows
as soon as the current JWT expires or the user logs out. It also triggers, when the user deletes the account in
another window.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
CallbackFunc.<null>
|
The function to be called when the event is triggered. | |
once |
boolean
|
<optional> |
Whether the event listener should be removed after being called once. |
This function can be called to remove the event listener.
# onUserDeleted(callback, onceopt) → {CleanupFunc}
Adds an event listener for hanko-user-deleted events. The event triggers, when the user has deleted the account.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
CallbackFunc.<null>
|
The function to be called when the event is triggered. | |
once |
boolean
|
<optional> |
Whether the event listener should be removed after being called once. |
This function can be called to remove the event listener.
# onUserLoggedOut(callback, onceopt) → {CleanupFunc}
Adds an event listener for hanko-user-deleted events. The event triggers, when the user has deleted the account in
the browser window where the deletion happened.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
CallbackFunc.<null>
|
The function to be called when the event is triggered. | |
once |
boolean
|
<optional> |
Whether the event listener should be removed after being called once. |
This function can be called to remove the event listener.
Type Definitions
# CallbackFunc(detail)
A callback function to be executed when an event is triggered.
Parameters:
Name | Type | Description |
---|---|---|
detail |
T
|
# CleanupFunc()
A function returned when adding an event listener. The function can be called to remove the corresponding event
listener.