addUICallback()

addUICallback(event: string, callback: function)

Overrides a UI (frontend) interaction using a callback function. The default action of the Samba's frontend will not execute, and instead your callback will override it.

For now only leaveSession UI callback is supported.

In the below example user will be asked by a confirmation popup before leaving the session:

const leaveSessionCallback = () => {
   console.log('Custom leave session logic called');
   if (confirm('Are you sure you want to leave the session?')) {
      sambaFrame.leaveSession();
   }
};

sambaFrame.addUICallback('leaveSession', leaveSessionCallback);

This method is often used in conjunction with the removeUICallback method.

Last updated