1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-01 04:43:29 +03:00

Convert src to ES6

The bulk of this is just export/import changes, though there's a couple pieces to highlight:
* We no longer use default exports. This is because it's discouraged by the JS community, though not in any official capacity.
* We now use `polyfillSuper` for some prototype inheritance because the tests, and sometimes webpack, break on "cannot call EncryptionAlgorithm without 'new'". It's very much a workaround, and definitely not needed when we use real classes.

There is some import shuffling to help keep the imports clean - this was done by my IDE.
This commit is contained in:
Travis Ralston
2019-12-17 15:04:27 -07:00
parent 4dbda8dffd
commit d3ce0cb82f
65 changed files with 706 additions and 861 deletions

View File

@@ -1,6 +1,7 @@
/*
Copyright 2017 Vector Creations Ltd
Copyright 2018 New Vector Ltd
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -20,9 +21,8 @@ limitations under the License.
* @module sync-accumulator
*/
import utils from "./utils";
import logger from './logger';
import {logger} from './logger';
import {deepCopy} from "./utils";
/**
* The purpose of this class is to accumulate /sync responses such that a
@@ -34,7 +34,7 @@ import logger from './logger';
* be loaded from disk and incremental syncs can be performed on the server,
* rather than asking the server to do an initial sync on startup.
*/
class SyncAccumulator {
export class SyncAccumulator {
/**
* @param {Object} opts
* @param {Number=} opts.maxTimelineEntries The ideal maximum number of
@@ -502,7 +502,7 @@ class SyncAccumulator {
// since we're going back in time, we need to use the previous
// state value else we'll break causality. We don't have the
// complete previous state event, so we need to create one.
const prevStateEvent = utils.deepCopy(timelineEvent);
const prevStateEvent = deepCopy(timelineEvent);
if (prevStateEvent.unsigned) {
if (prevStateEvent.unsigned.prev_content) {
prevStateEvent.content = prevStateEvent.unsigned.prev_content;
@@ -554,5 +554,3 @@ function setState(eventMap, event) {
}
eventMap[event.type][event.state_key] = event;
}
module.exports = SyncAccumulator;