Typed Event Emitter class which can act as a Base Model for all our model and communication events. This makes it much easier for us to distinguish between events, as we now need to properly type this, so that our events are not stringly-based and prone to silly typos.

Type parameters:

  • Events - List of all events emitted by this TypedEventEmitter. Normally an enum type.
  • Arguments - A ListenerMap type providing mappings from event names to listener types.
  • SuperclassArguments - TODO: not really sure. Alternative listener mappings, I think? But only honoured for .emit?

Hierarchy (view full)

Constructors

Properties

activeSpeaker?: CallFeed
activeSpeakerInterval: number = 1000
allowCallWithoutVideoAndAudio: boolean
groupCallId: string
isPtt: boolean
localCallFeed?: CallFeed
localDesktopCapturerSourceId?: string
localScreenshareFeed?: CallFeed
participantTimeout: number = ...
pttMaxTransmitTime: number = ...
retryCallInterval: number = 5000
room: Room
screenshareFeeds: CallFeed[] = []
userMediaFeeds: CallFeed[] = []

Accessors

  • get creationTs(): null | number
  • The timestamp at which the call was created, or null if it has not yet been created.

    Returns null | number

  • set creationTs(value): void
  • Parameters

    • value: null | number

    Returns void

  • get enteredViaAnotherSession(): boolean
  • Whether the local device has entered this call via another session, such as a widget.

    Returns boolean

  • set enteredViaAnotherSession(value): void
  • Parameters

    • value: boolean

    Returns void

Methods

  • Cleans up our member state by filtering out logged out devices, inactive devices, and our own device (if we know we haven't entered).

    Returns Promise<void>

  • Synchronously calls each of the listeners registered for the event named event, in the order they were registered, passing the supplied arguments to each.

    Type Parameters

    Parameters

    Returns boolean

    true if the event had listeners, false otherwise.

  • Synchronously calls each of the listeners registered for the event namedeventName, in the order they were registered, passing the supplied arguments to each.

    Returns true if the event had listeners, false otherwise.

    import EventEmitter from 'node:events';
    const myEmitter = new EventEmitter();

    // First listener
    myEmitter.on('event', function firstListener() {
    console.log('Helloooo! first listener');
    });
    // Second listener
    myEmitter.on('event', function secondListener(arg1, arg2) {
    console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
    });
    // Third listener
    myEmitter.on('event', function thirdListener(...args) {
    const parameters = args.join(', ');
    console.log(`event with parameters ${parameters} in third listener`);
    });

    console.log(myEmitter.listeners('event'));

    myEmitter.emit('event', 1, 2, 3, 4, 5);

    // Prints:
    // [
    // [Function: firstListener],
    // [Function: secondListener],
    // [Function: thirdListener]
    // ]
    // Helloooo! first listener
    // event with parameters 1, 2 in second listener
    // event with parameters 1, 2, 3, 4, 5 in third listener

    Type Parameters

    Returns boolean

    v0.1.26

  • Executes the given callback on all calls in this group call.

    Parameters

    Returns void

  • Sets the mute state of the local participants's video.

    Parameters

    • muted: boolean

      Whether to mute the video

    Returns Promise<boolean>

    Whether muting/unmuting was successful

  • Sets the mute state of the local participants's microphone.

    Parameters

    • muted: boolean

      Whether to mute the microphone

    Returns Promise<boolean>

    Whether muting/unmuting was successful