You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-09-01 21:21:58 +03:00
Default to a no-op store class to prevent having to constantly check for MatrixClient.store and other defensive checks which clutters the intent of the code.
74 lines
1.1 KiB
JavaScript
74 lines
1.1 KiB
JavaScript
"use strict";
|
|
/**
|
|
* This is an internal module.
|
|
* @module store/stub
|
|
*/
|
|
|
|
/**
|
|
* Construct a stub store. This does no-ops on all store methods.
|
|
* @constructor
|
|
*/
|
|
function StubStore() {
|
|
|
|
}
|
|
|
|
StubStore.prototype = {
|
|
|
|
/**
|
|
* No-op.
|
|
* @param {Room} room
|
|
*/
|
|
storeRoom: function(room) {
|
|
},
|
|
|
|
/**
|
|
* No-op.
|
|
* @param {string} roomId
|
|
* @return {null}
|
|
*/
|
|
getRoom: function(roomId) {
|
|
return null;
|
|
},
|
|
|
|
/**
|
|
* No-op.
|
|
* @return {Array} An empty array.
|
|
*/
|
|
getRooms: function() {
|
|
return [];
|
|
},
|
|
|
|
/**
|
|
* No-op.
|
|
* @return {Array} An empty array.
|
|
*/
|
|
getRoomSummaries: function() {
|
|
return [];
|
|
},
|
|
|
|
/**
|
|
* No-op.
|
|
* @param {User} user
|
|
*/
|
|
storeUser: function(user) {
|
|
},
|
|
|
|
/**
|
|
* No-op.
|
|
* @param {string} userId
|
|
* @return {null}
|
|
*/
|
|
getUser: function(userId) {
|
|
return null;
|
|
}
|
|
|
|
// TODO
|
|
//setMaxHistoryPerRoom: function(maxHistory) {},
|
|
|
|
// TODO
|
|
//reapOldMessages: function() {},
|
|
};
|
|
|
|
/** Stub Store class. */
|
|
module.exports = StubStore;
|