LogoLogo
CSPR.build PortalCSPR.click Website
CSPR.click v1.2
CSPR.click v1.2
  • Introduction (v1.2)
    • CSPR.click overview
    • Get your application Id
    • Changelog
  • UI SDK
    • Getting started with the template application
    • Integrating the UI SDK into your application
    • Integrating the UI SDK into a non-React application
    • Customizing the top bar
      • Account dropdown menu
      • Theme selector
      • Network selector
      • Language selector
      • Currency selector
      • Custom selector
    • useClickRef() hook
    • Handling events
    • Signing transactions
  • Core JS SDK
    • Getting started
    • Properties
    • Methods
    • Types
    • Events
  • Get support
    • Contact us
Powered by GitBook
On this page
  • csprclick:signed_in
  • csprclick:switched_account
  • csprclick:signed_out
  • csprclick:disconnected
  1. UI SDK

Handling events

PrevioususeClickRef() hookNextSigning transactions

Last updated 1 year ago

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 page in the Web SDK reference for a full list of events.

The following code shows an example of how to bind your handlers to the CSPR.click events:

useEffect(() => {
  clickRef?.on('csprclick:signed_in', async (evt) => {
    // update your app accordingly
  });
  clickRef?.on('csprclick:signed_out', async (evt) => {
    // update your app accordingly
  });
}, [clickRef?.on]);

csprclick:signed_in

This event is emitted every time the CSPR.click library connects to an account. The previous state was disconnected.

reference.

csprclick:switched_account

This event is emitted every time the CSPR.click livrary switches connection from one account to another.

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: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.

Receives the provider that has been disconnected.

reference.

reference.

csprclick:signed_out
csprclick:disconnected
Events
csprclick:switched_account
csprclick:signed_in