You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-12-01 04:43:29 +03:00
Add ability to set a filter prior to initial sync.
Useful for only syncing with a subset of joined rooms or only retrieving certain relevant types of events.
This commit is contained in:
@@ -2511,6 +2511,9 @@ MatrixClient.prototype.getTurnServers = function() {
|
|||||||
*
|
*
|
||||||
* @param {Number=} opts.pollTimeout The number of milliseconds to wait on /events.
|
* @param {Number=} opts.pollTimeout The number of milliseconds to wait on /events.
|
||||||
* Default: 30000 (30 seconds).
|
* Default: 30000 (30 seconds).
|
||||||
|
*
|
||||||
|
* @param {Filter=} opts.filter The filter to apply to /sync calls. This will override
|
||||||
|
* the opts.initialSyncLimit, which would normally result in a timeline limit filter.
|
||||||
*/
|
*/
|
||||||
MatrixClient.prototype.startClient = function(opts) {
|
MatrixClient.prototype.startClient = function(opts) {
|
||||||
if (this.clientRunning) {
|
if (this.clientRunning) {
|
||||||
|
|||||||
@@ -391,8 +391,13 @@ SyncApi.prototype.sync = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getFilter() {
|
function getFilter() {
|
||||||
var filter = new Filter(client.credentials.userId);
|
var filter;
|
||||||
filter.setTimelineLimit(self.opts.initialSyncLimit);
|
if (self.opts.filter) {
|
||||||
|
filter = self.opts.filter;
|
||||||
|
} else {
|
||||||
|
filter = new Filter(client.credentials.userId);
|
||||||
|
filter.setTimelineLimit(self.opts.initialSyncLimit);
|
||||||
|
}
|
||||||
|
|
||||||
client.getOrCreateFilter(
|
client.getOrCreateFilter(
|
||||||
getFilterName(client.credentials.userId), filter
|
getFilterName(client.credentials.userId), filter
|
||||||
|
|||||||
Reference in New Issue
Block a user