Class: MatrixInMemoryStore

store/memory.MatrixInMemoryStore

new MatrixInMemoryStore(optsopt)

Construct a new in-memory data store for the Matrix Client.
Parameters:
Name Type Attributes Description
opts Object <optional>
Config options
Properties
Name Type Description
localStorage LocalStorage The local storage instance to persist some forms of data such as tokens. Rooms will NOT be stored. See WebStorageStore to persist rooms.
Source:

Methods

_onRoomMember(event, state, member)

Called when a room member in a room being tracked by this store has been updated.
Parameters:
Name Type Description
event MatrixEvent
state RoomState
member RoomMember
Source:

getAccountData(eventType) → (nullable) {MatrixEvent}

Get account data event by event type
Parameters:
Name Type Description
eventType string The event type being queried
Source:
Returns:
the user account_data event of given type, if any
Type
MatrixEvent

getFilter(userId, filterId) → (nullable) {Filter}

Retrieve a filter.
Parameters:
Name Type Description
userId string
filterId string
Source:
Returns:
A filter or null.
Type
Filter

getFilterIdByName(filterName) → (nullable) {string}

Retrieve a filter ID with the given name.
Parameters:
Name Type Description
filterName string The filter name.
Source:
Returns:
The filter ID or null.
Type
string

getRoom(roomId) → {Room}

Retrieve a room by its' room ID.
Parameters:
Name Type Description
roomId string The room ID.
Source:
Returns:
The room or null.
Type
Room

getRooms() → {Array.<Room>}

Retrieve all known rooms.
Source:
Returns:
A list of rooms, which may be empty.
Type
Array.<Room>

getRoomSummaries() → {Array.<RoomSummary>}

Retrieve a summary of all the rooms.
Source:
Returns:
A summary of each room.
Type
Array.<RoomSummary>

getSyncToken() → {string}

Retrieve the token to stream from.
Source:
Returns:
The token or null.
Type
string

getUser(userId) → {User}

Retrieve a User by its' user ID.
Parameters:
Name Type Description
userId string The user ID.
Source:
Returns:
The user or null.
Type
User

getUsers() → {Array.<User>}

Retrieve all known users.
Source:
Returns:
A list of users, which may be empty.
Type
Array.<User>

removeRoom(roomId)

Permanently delete a room.
Parameters:
Name Type Description
roomId string
Source:

scrollback(room, limit) → {Array.<Object>}

Retrieve scrollback for this room.
Parameters:
Name Type Description
room Room The matrix room
limit integer The max number of old events to retrieve.
Source:
Returns:
An array of objects which will be at most 'limit' length and at least 0. The objects are the raw event JSON.
Type
Array.<Object>

setFilterIdByName(filterName, filterId)

Set a filter name to ID mapping.
Parameters:
Name Type Description
filterName string
filterId string
Source:

setSyncToken(token)

Set the token to stream from.
Parameters:
Name Type Description
token string The token to stream from.
Source:

storeAccountDataEvents(events)

Store user-scoped account data events. N.B. that account data only allows a single event per type, so multiple events with the same type will replace each other.
Parameters:
Name Type Description
events Array.<MatrixEvent> The events to store.
Source:

storeEvents(room, events, token, toStart)

Store events for a room. The events have already been added to the timeline
Parameters:
Name Type Description
room Room The room to store events for.
events Array.<MatrixEvent> The events to store.
token string The token associated with these events.
toStart boolean True if these are paginated results.
Source:

storeFilter(filter)

Store a filter.
Parameters:
Name Type Description
filter Filter
Source:

storeRoom(room)

Store the given room.
Parameters:
Name Type Description
room Room The room to be stored. All properties must be stored.
Source:

storeUser(user)

Store a User.
Parameters:
Name Type Description
user User The user to store.
Source: