Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Properties

messages

messages: MessageType[] = []

List of all messages sorted from oldest to most recent.

Readonly room_id

room_id: string

Room's id.

Accessors

Events

Methods

hasOlder

  • hasOlder(): boolean
  • Indicates if there are any older messages to load.

    Returns boolean

hasUnread

  • hasUnread(id: string): boolean
  • Indicates if participant has any unread messages.

    Parameters

    • id: string

      Participant's id

    Returns boolean

haveUnread

  • haveUnread(): boolean
  • Indicates if current user has any unread messages.

    Returns boolean

isRead

  • isRead(timestamp: string): boolean
  • Indicates if message with the specified timestamp was read by anyone except current user.

    Parameters

    • timestamp: string

      Message's timestamp

    Returns boolean

isReadBy

  • isReadBy(timestamp: string, userId: string): boolean
  • Indicates if participant has read the message with the specified timestamp.

    Parameters

    • timestamp: string

      Message's timestamp

    • userId: string

      Participant's id

    Returns boolean

isReadByMe

  • isReadByMe(timestamp: string): boolean
  • Indicates if current user has read the message with the specified timestamp.

    Parameters

    • timestamp: string

      Message's timestamp

    Returns boolean

lastRead

  • lastRead(id: string): string
  • Get participant's last read message's timestamp.

    Parameters

    • id: string

      Participant's id

    Returns string

lastReadByMe

  • lastReadByMe(): string
  • Get current user's last read message's timestamp.

    Returns string

loadOlder

  • loadOlder(timestamp?: string): Promise<History>
  • Used for loading older chat room's history. Consecutive calls will be handled in a queue. Triggers HistoryEvents.OLD_LOADED on success.

    throws

    ChatError

    Parameters

    • Optional timestamp: string

      Timestamp to load messages before, by default oldest message's timestamp is used

    Returns Promise<History>

loadUnread

markAsRead

  • markAsRead(timestamp: string): Promise<History>
  • markAsRead(timestamps: string[]): Promise<History>

off

  • off(): void
  • off<E>(event: E): void
  • off<E>(events: E[]): void
  • off<E>(event: E, listener: EventListener<HistoryListeners[E]>): void
  • off<E>(events: E[], listener: EventListener<HistoryListeners[E]>): void
  • Removes all listeners.

    Returns void

  • Removes all listeners for event.

    Type parameters

    Parameters

    • event: E

    Returns void

  • Removes all listeners for events.

    Type parameters

    Parameters

    • events: E[]

    Returns void

  • Removes specific listener for event.

    Type parameters

    Parameters

    • event: E
    • listener: EventListener<HistoryListeners[E]>

    Returns void

  • Removes specific listener for multiple events.

    Type parameters

    Parameters

    • events: E[]
    • listener: EventListener<HistoryListeners[E]>

    Returns void

on

  • on<E>(event: E, listener: EventListener<HistoryListeners[E]>): void
  • on<E>(events: E[], listener: EventListener<HistoryListeners[E]>): void
  • Adds listener for event.

    Type parameters

    Parameters

    • event: E
    • listener: EventListener<HistoryListeners[E]>

    Returns void

  • Adds the same listener for multiple events.

    Type parameters

    Parameters

    • events: E[]
    • listener: EventListener<HistoryListeners[E]>

    Returns void

publish

readBy

  • readBy(timestamp: string): string[]
  • Returns list of users' ids (except current user) who read the message with the specified timestamp.

    Parameters

    • timestamp: string

      Message's timestamp

    Returns string[]

unreadLoaded

  • unreadLoaded(): boolean
  • Indicates if all unread messages are loaded.

    Returns boolean