Skip to main content

EventManager

TypeNameInterface Description
Static FunctionsgetObjectEmitter(obj: AObject): IEventEmitter

@description Retrieves the event emitter associated with a given object.

@param obj - The object for which to get the event emitter. This can be an AObject.

@returns The event emitter for the specified object, or undefined if the object is invalid or not supported.

Static FunctionsgetGlobalEmitter(): IEventEmitter

@description Retrieves the global event emitter instance. If it doesn't exist, it creates a new one.

@returns The global event emitter instance.

Static FunctionscreateEvent(eventType: number): IEvent

@description Create and return a new event instance based on the provided event type.

@param eventType - The type of the event, which can be either a numeric code or a predefined UserEventType enum value.

@returns An IEvent object representing the created event.

Static FunctionsdefineUserEventType(eventName: number|string): UserEventType

@description Define a user-defined event type. This method allows you to create and register a custom event type with a unique identifier, which can be used to trigger and handle events in your application.

@param eventName - The unique identifier for the user event type. Can be either a number or a string.

@returns The newly defined or existing UserEventType instance with the provided identifier.

Examples

getObjectEmitter(obj: AObject): IEventEmitter

const emitter = APJS.EventManager.getObjectEmitter(myObject);
emitter.emit(myEvent);

getGlobalEmitter(): IEventEmitter

const emitter = APJS.EventManager.getGlobalEmitter();
emitter.emit(myEvent);

createEvent(eventType: number): IEvent

const event = APJS.EventManager.createEvent(myEventType);

defineUserEventType(eventName: number|string): UserEventType

const USER_EVENT_01: UserEventType = APJS.EventManager.defineUserEventType(42);
const USER_EVENT_02: UserEventType = APJS.EventManager.defineUserEventType('foo');
Copyright © 2025 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalCookies