1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-09-01 21:21:58 +03:00
Files
matrix-js-sdk/lib/store/stub.js
Kegan Dougal b7ed78b432 Update CHANGELOG. Add StubStore.
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.
2015-06-23 11:03:08 +01:00

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;