Message

Message

Represents a Message

Constructor

# new Message(options)

import Message from "https://designftw.github.io/chat-lib/src/models/Message.js";

Message model constructor.

Parameters:
Name Type Description
options Object
Properties
Name Type Description
id string

see BaseModel's id property

createdAt Date

see BaseModel's createdAt property

updatedAt Date

see BaseModel's updatedAt property

sender Identity

see Message's sender property

recipients Array.<Identity>

see Message's recipients property

data Object

see Message's data property

Members

# data :Object

The data associated with the message.

This could be just message text but could also be arbitrary JSON.

Type:
  • Object

# recipients :Array.<Identity>

The identities who received the message

Type:

# sender :Identity

The identity who sent the message

Type:

Methods

# toJSON() → {Object}

Convert this message to a JSON object that could be fed to its constructor to create another object with the same data

Returns:
Type
Object