onPanelEvent
Send panel events to the Client App to be handle.
Overview
The onPanelEvent method is called when there is either a user interaction that needs to be communicated by the Client App, or a internal panel event that needs to be notified. Each event comes with a type and payload so the App can act accordingly.
Method Signature
export type RequestLoginPanelEvent = {
type: 'fantasy:request:login';
payload: {
/**
* @description Callback to be called by the client app once the login process is completed, so the SDK can refresh its state accordingly.
*/
onLoginSuccess: () => void;
};
};
export type PanelEvent = RequestLoginPanelEvent;
onPanelEvent(event: PanelEvent): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
event | PanelEvent | A union type of events. This includes things like fantasy:request:login and others that will be added. |
Return Value
Does not return a value.
Example
class Delegate implements IMaestroEventDelegate {
onPanelEvent(event: PanelEvent): void {
if (event.type === "fantasy:request:login") {
this.toggleLogin();
// Each event will have its own signature. In this case, we want to know (if necessary) when the user has successfully logged in to refresh the panel
event.payload.onLoginSuccess();
}
}
}