This commit is contained in:
Aakansha Doshi 2021-02-06 20:08:30 +05:30
parent 8157c84d11
commit b5151bda5a
4 changed files with 14 additions and 9 deletions

View file

@ -1,4 +1,3 @@
// @ts-nocheck
import { Point, simplify } from "points-on-curve";
import React from "react";
import { RoughCanvas } from "roughjs/bin/canvas";
@ -854,9 +853,15 @@ class App extends React.Component<ExcalidrawProps, AppState> {
) {
if (this.state.showStats && this.props.isCollaborating) {
this.calculateNetStats();
navigator.connection.addEventListener("change", this.calculateNetStats);
// @ts-ignore
navigator?.connection?.addEventListener(
"change",
this.calculateNetStats,
);
} else {
navigator.connection.removeEventListener(
// @ts-ignore
navigator?.connection?.removeEventListener(
"change",
this.calculateNetStats,
);
@ -990,7 +995,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
private calculateNetStats = async () => {
const speed = await getNetworkSpeed();
const networkSpeed = speed === -1 ? "Error!" : speed;
const networkSpeed = speed === "-1" ? "Error!" : speed;
this.setState({ networkSpeed });
};
// Copy/paste