Event
SDK exports types for platform events:
ts
import type {
EventCallback,
EventCallbacks,
EventEmitParams,
EventInfo,
EventParams,
EventTarget
} 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 |
EventEmitParams
Parameters of the static Event.emit() method
| Property | Type | Description |
|---|---|---|
target | EventTarget | Object identifying the target event on the platform |
info | EventInfo | Arbitrary event data |
EventInfo
Arbitrary event data, passed in the Event.emit() method and delivered to handlers registered via Event.on() and Event.once()
ts
type EventInfo = Record<string, any>| Property | Type | Description |
|---|---|---|
[key: string] | any | Arbitrary event data |
EventParams
Parameters of the Event constructor
| Property | Type | Description |
|---|---|---|
target | EventTarget | Object identifying the target event on the platform |
events | EventCallbacks<EventEventName> | Instance event handlers |
EventTarget
Object identifying the target event on the platform, used in the Event.target property, the Event constructor and the static Event.emit() method
ts
type EventTarget = Record<string, any>| Property | Type | Description |
|---|---|---|
[key: string] | any | Arbitrary data identifying the event |