1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +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,5 +1,6 @@
/*
Copyright 2015, 2016 OpenMarket 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.
@@ -19,8 +20,8 @@ limitations under the License.
* of requests.
* @module scheduler
*/
const utils = require("./utils");
import logger from './logger';
import * as utils from "./utils";
import {logger} from './logger';
const DEBUG = false; // set true to enable console logging.
@@ -36,7 +37,7 @@ const DEBUG = false; // set true to enable console logging.
* algorithm to apply when determining which events should be sent before the
* given event. Defaults to {@link module:scheduler~MatrixScheduler.QUEUE_MESSAGES}.
*/
function MatrixScheduler(retryAlgorithm, queueAlgorithm) {
export function MatrixScheduler(retryAlgorithm, queueAlgorithm) {
this.retryAlgorithm = retryAlgorithm || MatrixScheduler.RETRY_BACKOFF_RATELIMIT;
this.queueAlgorithm = queueAlgorithm || MatrixScheduler.QUEUE_MESSAGES;
this._queues = {
@@ -318,7 +319,3 @@ function debuglog() {
* @return {Promise} Resolved/rejected depending on the outcome of the request.
*/
/**
* The MatrixScheduler class.
*/
module.exports = MatrixScheduler;