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 Summary)

Constructors

Properties

disambiguate: boolean = false

True if the member's name is disambiguated.

events: { member?: MatrixEvent } = {}

The events describing this RoomMember.

Type declaration

  • Optionalmember?: MatrixEvent

    The m.room.member event for this RoomMember.

membership?: string

The membership state for this room member e.g. 'join'.

name: string

The human-readable name for this room member. This will be disambiguated with a suffix of " (@user_id:matrix.org)" if another member shares the same displayname.

powerLevel: number = 0

The power level for this room member.

powerLevelNorm: number = 0

The normalised power level (0-100) for this room member.

rawDisplayName: string

The ambiguous displayname of this room member.

requestedProfileInfo: boolean = false
roomId: string

The room ID of the member.

typing: boolean = false

True if the room member is currently typing.

user?: User

The User object for this room member, if one exists.

userId: string

The user ID of the member.

Methods

  • Get the avatar URL for a room member.

    Parameters

    • baseUrl: string

      The base homeserver URL See MatrixClient#getHomeserverUrl.

    • width: number

      The desired width of the thumbnail.

    • height: number

      The desired height of the thumbnail.

    • resizeMethod: string

      The thumbnail resize method to use, either "crop" or "scale".

    • allowDefault: boolean = true

      (optional) Passing false causes this method to return null if the user has no avatar image. Otherwise, a default image URL will be returned. Default: true. (Deprecated)

    • allowDirectLinks: boolean

      (optional) If true, the avatar URL will be returned even if it is a direct hyperlink rather than a matrix content URL. If false, any non-matrix content URLs will be ignored. Setting this option to true will expose URLs that, if fetched, will leak information about the user to anyone who they share a room with.

    Returns null | string

    the avatar URL or null.

  • If this member was invited with the is_direct flag set, return the user that invited this member

    Returns undefined | string

    user id of the inviter

  • Get the timestamp when this RoomMember was last updated. This timestamp is updated when properties on this RoomMember are updated. It is updated before firing events.

    Returns number

    The timestamp

  • get the mxc avatar url, either from a state event, or from a lazily loaded member

    Returns undefined | string

    the mxc avatar url

  • Returns boolean

    does the member come from a channel that is not sync? This is used to store the member seperately from the sync state so it available across browser sessions.