Skip to main content

getCurrentEventID

Returns the active event ID(s) for the current session.

Breaking Change

The return type of getCurrentEventID changed from string | null to string | string[] | null. In a multi-event session, this method returns all active event IDs as string[] rather than a single string.

Update any code that assumes the return value is always a string. Use a type guard (Array.isArray(result)) or switch to getCurrentEventIDs, which always returns string[] and is the preferred API for multi-event sessions.

Overview

Use this method to retrieve the event ID(s) for the current session.

  • Single-event session — returns the event ID as a string.
  • Multi-event session — returns all active event IDs as string[], in the same order they were passed to userDidStartWatchingEvent.
  • No active session — returns null.

For multi-event sessions, getCurrentEventIDs is equivalent and often clearer because it always returns string[].

Method Signature

getCurrentEventID(): string | string[] | null;

Parameters

This method takes no parameters.

Return Value

The active event ID(s) for the current session, or null if no session is active.

StateReturn value
Single-event sessionstring — the active event ID
Multi-event sessionstring[] — all active event IDs
No active sessionnull

Example

const eventId = SDK.getMaestroEventViewModel().getCurrentEventID();

if (eventId === null) {
console.log('No active session.');
} else if (Array.isArray(eventId)) {
// Multi-event session
console.log('Active event IDs:', eventId);
} else {
// Single-event session
console.log('Active event ID:', eventId);
}

Notes

  • Use getCurrentEventIDs when you always need an array — it returns string[] in both single- and multi-event sessions.
  • The return type is string | string[] | null rather than always string[] for backward compatibility.