Handling events
In your application, you'll need to listen and respond to different events emitted by the CSPR.click library. On this page, we're covering the most common. Check the Events page for a complete list of events.
The following code snippet shows an example of how to bind your handlers to the CSPR.click events with the React useEffect()
hook:
csprclick:signed_in
This event is emitted every time the CSPR.click library connects to an account.
csprclick:signed_in reference.
csprclick:switched_account
This event is emitted instead of csprclick:signed_i
when the user has clicked on the Switch Account menu item and has switched to another account in the same or a different wallet.
csprclick:switched_account reference.
csprclick:signed_out
This event is emitted when the CSPR.click library disconnects the active account due to a call to the signOut()
SDK method.
csprclick:signed_out reference.
csprclick:disconnected
This event is emitted when CSPR.click library receives a disconnect request or event from the connected wallet. The app should close the current session as a consequence of this event.
It receives in the event object the provider that has been disconnected.
csprclick:disconnected reference.
Last updated