1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-19 16:42:09 +03:00

Actually allow MatrixClient to not have a store. Update jsdoc.

This commit is contained in:
Kegan Dougal
2015-06-18 09:59:02 +01:00
parent d151ac49f2
commit 9cb37fbe4f
3 changed files with 26 additions and 10 deletions

View File

@@ -35,15 +35,18 @@ module.exports.request = function(r) {
};
/**
* Construct a Matrix Client. Identical to {@link module:client.MatrixClient}
* except the 'request' option is already specified.
* Construct a Matrix Client. Similar to {@link module:client~MatrixClient}
* except that the 'request', 'store' and 'scheduler' dependencies are satisfied.
* @param {(Object|string)} opts The configuration options for this client. If
* this is a string, it is assumed to be the base URL.
* this is a string, it is assumed to be the base URL. These configuration
* options will be passed directly to {@link module:client~MatrixClient}.
* @param {string} opts.baseUrl The base URL to the client-server HTTP API.
* @param {string} opts.accessToken Optional. The access_token for this user.
* @param {string} opts.userId Optional. The user ID for this user.
* @param {Object} opts.store Optional. The data store to use. Defaults to
* {@link module:store/memory.MatrixInMemoryStore}.
* @param {Object} opts.scheduler Optional. The scheduler to use. Defaults to
* {@link module:scheduler.BasicScheduler}.
* @return {MatrixClient} A new matrix client.
*/
module.exports.createClient = function(opts) {
@@ -53,6 +56,7 @@ module.exports.createClient = function(opts) {
};
}
opts.request = request;
opts.store = new module.exports.MatrixInMemoryStore();
return new module.exports.MatrixClient(opts);
};