Events
SDK exports common event types and event name enumerations for class methods:
ts
import type {
EventCallback,
EventCallbacks,
FrameEventName,
FrameOpenUrlEventName,
FrameOpenHomepageEventName,
OAuth2EventName,
ToastEventName,
SwalEventName,
ModalEventName,
SidepanelEventName
} from '@aspro-cloud/miniapp-jssdk'Types
EventCallback
Event callback function
ts
type EventCallback<T = any> = (data: T) => void| Parameter | Type | Description |
|---|---|---|
data | any | Event data |
EventCallbacks
Object with event handlers, passed in method and constructor parameters
ts
type EventCallbacks<TEventName extends string = string> =
Partial<Record<TEventName, EventCallback<any> | null>> | null| Property | Type | Description |
|---|---|---|
[eventName: string] | EventCallback | null | Event handler |
FrameEventName
Event names for Frame.initialize()
| Value | Description |
|---|---|
'onReady' | Fired after iframe content is loaded (DOMContentLoaded), Frame is initialized and context is received, embedded content is displayed |
FrameOpenUrlEventName
Event names for Frame.openUrl()
| Value | Description |
|---|---|
'onOpen' | URL opened |
'onCancel' | URL opening cancelled |
FrameOpenHomepageEventName
Event names for Frame.openHomepage()
| Value | Description |
|---|---|
'onOpen' | Application homepage opened |
'onCancel' | Opening cancelled |
OAuth2EventName
Event names for OAuth2.refresh()
| Value | Description |
|---|---|
'onRefresh' | Tokens successfully refreshed |
ToastEventName
Event names for Toast.show()
| Value | Description |
|---|---|
'onShow' | Notification is shown |
'onHide' | Notification is hidden |
'onClose' | Notification is closed by user |
SwalEventName
Event names for Swal.alert()
| Value | Description |
|---|---|
'onShow' | Dialog is shown |
'onHide' | Dialog is hidden |
'onCancel' | User cancelled the action |
Event names for Swal.confirm()
| Value | Description |
|---|---|
'onShow' | Dialog is shown |
'onHide' | Dialog is hidden |
'onCancel' | User cancelled the action |
'onConfirm' | User confirmed the action |
Event names for Swal.prompt()
| Value | Description |
|---|---|
'onShow' | Dialog is shown |
'onHide' | Dialog is hidden |
'onCancel' | User cancelled the action |
'onPrompt' | User entered a value |
ModalEventName
Event names for Modal.show()
| Value | Description |
|---|---|
'onShow' | Modal window is shown |
'onHide' | Modal window is hidden |
'onClose' | Modal window is closed by user |
SidepanelEventName
Event names for Sidepanel.show()
| Value | Description |
|---|---|
'onShow' | Side panel is shown |
'onHide' | Side panel is hidden |
'onClose' | Side panel is closed by user |