update image size to be ~3kb and check speed every 15seconds

This commit is contained in:
Aakansha Doshi 2021-02-07 02:55:03 +05:30
parent 336b7222de
commit 7cadc3de52
3 changed files with 17 additions and 3 deletions

View file

@ -1,6 +1,6 @@
const IMAGE_URL =
"https://user-images.githubusercontent.com/11256141/107117897-76fa3880-68a3-11eb-9ec6-c214c7af373b.png";
const IMAGE_SIZE = 4525154; // in bytes
"https://user-images.githubusercontent.com/11256141/107128597-feb46700-68e4-11eb-80f7-1d259cc0151f.png";
const IMAGE_SIZE = 2666; // in bytes
const calculateSpeed = (startTime: number, endTime: number) => {
const duration = (endTime - startTime) / 1000;
const imageSizeInBits = IMAGE_SIZE * 8;
@ -15,7 +15,7 @@ const calculateSpeed = (startTime: number, endTime: number) => {
};
const processImage = (): Promise<string> => {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
const image = new Image();
let endTime: number;
image.onload = () => {