Skip to content

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
ParameterTypeDescription
dataanyEvent 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
PropertyTypeDescription
[eventName: string]EventCallback | nullEvent handler

EventEmitParams

Parameters of the static Event.emit() method

PropertyTypeDescription
targetEventTargetObject identifying the target event on the platform
infoEventInfoArbitrary 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>
PropertyTypeDescription
[key: string]anyArbitrary event data

EventParams

Parameters of the Event constructor

PropertyTypeDescription
targetEventTargetObject identifying the target event on the platform
eventsEventCallbacks<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>
PropertyTypeDescription
[key: string]anyArbitrary data identifying the event

Published under the MIT license.