From 20f3684b0ebb31b43f9ed4aa6c594714e7a087e3 Mon Sep 17 00:00:00 2001 From: champ Date: Thu, 15 Jul 2021 16:46:15 +0800 Subject: [PATCH] fix typos (#94) --- scripts/certbot.sh | 4 ++-- scripts/helm/README.md | 2 +- tracker/tracker/src/main/app/index.ts | 28 +++++++++++++------------- tracker/tracker/src/main/index.ts | 22 ++++++++++---------- tracker/tracker/src/main/utils.ts | 8 ++++---- tracker/tracker/src/messages/writer.ts | 8 ++++---- tracker/tracker/src/webworker/index.ts | 16 +++++++-------- 7 files changed, 44 insertions(+), 44 deletions(-) diff --git a/scripts/certbot.sh b/scripts/certbot.sh index 2e09e7420..42cb00015 100755 --- a/scripts/certbot.sh +++ b/scripts/certbot.sh @@ -4,12 +4,12 @@ set -e # This script won't work for aws, as it's black listed -echo -e "This script won't work for aws default domain names assosiated with public ips, as it's black listed in letsencrypt\nso if youre running on aws with default domain names, please press ctrl+c with in 5 seconds" +echo -e "This script won't work for aws default domain names associated with public ips, as it's black listed in letsencrypt\nso if you're running on aws with default domain names, please press ctrl+c with in 5 seconds" sleep 5 homedir=${HOME} -echo please enter your dns name : +echo please enter your dns name : read dns_name echo please enter your email id: read emai_id diff --git a/scripts/helm/README.md b/scripts/helm/README.md index 871b6c7f9..f4a842546 100644 --- a/scripts/helm/README.md +++ b/scripts/helm/README.md @@ -1,6 +1,6 @@ ## Helm charts for installing OpenReplay components -Installation components are separated by namepaces. +Installation components are separated by namespaces. **Namespace:** diff --git a/tracker/tracker/src/main/app/index.ts b/tracker/tracker/src/main/app/index.ts index 6e862e0bb..8fc79a7ac 100644 --- a/tracker/tracker/src/main/app/index.ts +++ b/tracker/tracker/src/main/app/index.ts @@ -130,11 +130,11 @@ export default class App { try { fn.apply(this, args); } catch (e) { - app.send(new TechnicalInfo("error", JSON.stringify({ - time: timestamp(), - name: e.name, + app.send(new TechnicalInfo("error", JSON.stringify({ + time: timestamp(), + name: e.name, message: e.message, - stack: e.stack + stack: e.stack }))); } } as any // TODO: correct typing @@ -163,7 +163,7 @@ export default class App { target.removeEventListener(type, listener, useCapture), ); } - + getSessionToken(): string | undefined { const token = sessionStorage.getItem(this.options.session_token_key); if (token !== null) { @@ -188,7 +188,7 @@ export default class App { if (!this.isActive) { this.isActive = true; if (!this.worker) { - throw new Error("Stranger things: no worker found"); + throw new Error("Stranger things: no worker found"); } let pageNo: number = 0; @@ -200,15 +200,15 @@ export default class App { sessionStorage.setItem(this.options.session_pageno_key, pageNo.toString()); const startTimestamp = timestamp(); - const messageData: WorkerMessageData = { - ingestPoint: this.options.ingestPoint, - pageNo, + const messageData: WorkerMessageData = { + ingestPoint: this.options.ingestPoint, + pageNo, startTimestamp, connAttemptCount: this.options.connAttemptCount, connAttemptGap: this.options.connAttemptGap, } - this.worker.postMessage(messageData); // brings delay of 10th ms? - window.fetch(this.options.ingestPoint + '/v1/web/start', { + this.worker.postMessage(messageData); // brings delay of 10th ms? + window.fetch(this.options.ingestPoint + '/v1/web/start', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -235,9 +235,9 @@ export default class App { }) .then(r => { const { token, userUUID, sessionID } = r; - if (typeof token !== 'string' || + if (typeof token !== 'string' || typeof userUUID !== 'string') { - throw new Error("Incorrect server responce"); + throw new Error("Incorrect server response"); } sessionStorage.setItem(this.options.session_token_key, token); localStorage.setItem(this.options.local_uuid_key, userUUID); @@ -245,7 +245,7 @@ export default class App { this._sessionID = sessionID; } if (!this.worker) { - throw new Error("Stranger things: no worker found after start request"); + throw new Error("Stranger things: no worker found after start request"); } this.worker.postMessage({ token }); this.observer.observe(); diff --git a/tracker/tracker/src/main/index.ts b/tracker/tracker/src/main/index.ts index ff90b51e5..0829651cc 100644 --- a/tracker/tracker/src/main/index.ts +++ b/tracker/tracker/src/main/index.ts @@ -17,7 +17,7 @@ import Scroll from './modules/scroll'; import Viewport from './modules/viewport'; import Longtasks from './modules/longtasks'; import CSSRules from './modules/cssrules'; -import { IN_BROWSER, depricationWarn } from './utils'; +import { IN_BROWSER, deprecationWarn } from './utils'; import { Options as AppOptions } from './app'; import { Options as ExceptionOptions } from './modules/exception'; @@ -27,7 +27,7 @@ import { Options as TimingOptions } from './modules/timing'; export type Options = Partial< AppOptions & ConsoleOptions & ExceptionOptions & InputOptions & TimingOptions > & { - projectID?: number; // For the back compatibility only (depricated) + projectID?: number; // For the back compatibility only (deprecated) projectKey: string; sessionToken?: string; respectDoNotTrack?: boolean; @@ -46,10 +46,10 @@ function processOptions(obj: any): obj is Options { if (typeof obj.projectKey !== 'number') { if (typeof obj.projectID !== 'number') { // Back compatability console.error(`OpenReplay: projectKey is missing or wrong type (string is expected). Please, check https://docs.openreplay.com${ DOCS_SETUP } for more information.`) - return false + return false } else { obj.projectKey = obj.projectID.toString(); - depricationWarn("`projectID` option", "`projectKey` option", DOCS_SETUP) + deprecationWarn("`projectID` option", "`projectKey` option", DOCS_SETUP) } } else { console.warn("OpenReplay: projectKey is expected to have a string type.") @@ -99,7 +99,7 @@ export default class API { Longtasks(this.app); (window as any).__OPENREPLAY__ = (window as any).__OPENREPLAY__ || this; } else { - console.log("OpenReplay: broeser doesn't support API required for tracking.") + console.log("OpenReplay: browser doesn't support API required for tracking.") const req = new XMLHttpRequest(); const orig = options.ingestPoint || DEFAULT_INGEST_POINT; req.open("POST", orig + "/v1/web/not-started"); @@ -125,7 +125,7 @@ export default class API { return this.app.active(); } active(): boolean { - depricationWarn("'active' method", "'isActive' method", "/") + deprecationWarn("'active' method", "'isActive' method", "/") return this.isActive(); } @@ -159,7 +159,7 @@ export default class API { return this.app.getSessionID(); } sessionID(): string | null | undefined { - depricationWarn("'sessionID' method", "'getSessionID' method", "/"); + deprecationWarn("'sessionID' method", "'getSessionID' method", "/"); return this.getSessionID(); } @@ -169,7 +169,7 @@ export default class API { } } userID(id: string): void { - depricationWarn("'userID' method", "'setUserID' method", "/"); + deprecationWarn("'userID' method", "'setUserID' method", "/"); this.setUserID(id); } @@ -179,7 +179,7 @@ export default class API { } } userAnonymousID(id: string): void { - depricationWarn("'userAnonymousID' method", "'setUserAnonymousID' method", "/") + deprecationWarn("'userAnonymousID' method", "'setUserAnonymousID' method", "/") this.setUserAnonymousID(id); } @@ -193,7 +193,7 @@ export default class API { } } metadata(key: string, value: string): void { - depricationWarn("'metadata' method", "'setMetadata' method", "/") + deprecationWarn("'metadata' method", "'setMetadata' method", "/") this.setMetadata(key, value); } @@ -231,7 +231,7 @@ export default class API { handleErrorEvent = (e: ErrorEvent | PromiseRejectionEvent) => { if ( - (e instanceof ErrorEvent || + (e instanceof ErrorEvent || ('PromiseRejectionEvent' in window && e instanceof PromiseRejectionEvent) ) && this.app !== null diff --git a/tracker/tracker/src/main/utils.ts b/tracker/tracker/src/main/utils.ts index c2e97c7c5..350447b62 100644 --- a/tracker/tracker/src/main/utils.ts +++ b/tracker/tracker/src/main/utils.ts @@ -33,11 +33,11 @@ export const warn = console.warn const DOCS_HOST = 'https://docs.openreplay.com'; const warnedFeatures: { [key: string]: boolean; } = {}; -export function depricationWarn(nameOfFeature: string, useInstead: string, docsPath: string = "/"): void { +export function deprecationWarn(nameOfFeature: string, useInstead: string, docsPath: string = "/"): void { if (warnedFeatures[ nameOfFeature ]) { return; } - warn(`OpenReplay: ${ nameOfFeature } is depricated. ${ useInstead ? `Please, use ${ useInstead } instead.` : "" } Visit ${DOCS_HOST}${docsPath} for more information.`) + warn(`OpenReplay: ${ nameOfFeature } is deprecated. ${ useInstead ? `Please, use ${ useInstead } instead.` : "" } Visit ${DOCS_HOST}${docsPath} for more information.`) warnedFeatures[ nameOfFeature ] = true; } @@ -48,7 +48,7 @@ export function getLabelAttribute(e: Element): string | null { } value = e.getAttribute("data-asayer-label"); if (value !== null) { - depricationWarn(`"data-asayer-label" attribute`, `"data-openreplay-label" attribute`, "/"); + deprecationWarn(`"data-asayer-label" attribute`, `"data-openreplay-label" attribute`, "/"); } return value; } @@ -60,7 +60,7 @@ export function hasOpenreplayAttribute(e: Element, name: string): boolean { } const oldName = `data-asayer-${name}`; if (e.hasAttribute(oldName)) { - depricationWarn(`"${oldName}" attribute`, `"${newName}" attribute`, "/installation/sanitize-data"); + deprecationWarn(`"${oldName}" attribute`, `"${newName}" attribute`, "/installation/sanitize-data"); return true; } return false; diff --git a/tracker/tracker/src/messages/writer.ts b/tracker/tracker/src/messages/writer.ts index 3a88b1e0f..5ce52d330 100644 --- a/tracker/tracker/src/messages/writer.ts +++ b/tracker/tracker/src/messages/writer.ts @@ -61,13 +61,13 @@ const textEncoder: { encode(str: string): Uint8Array } = export default class Writer { private offset: number = 0; - private checkpontOffset: number = 0; + private checkpointOffset: number = 0; private readonly data: Uint8Array; constructor(private readonly size: number) { this.data = new Uint8Array(size); } checkpoint(): void { - this.checkpontOffset = this.offset; + this.checkpointOffset = this.offset; } isEmpty(): boolean { return this.offset === 0; @@ -100,10 +100,10 @@ export default class Writer { } reset(): void { this.offset = 0; - this.checkpontOffset = 0; + this.checkpointOffset = 0; } flush(): Uint8Array { - const data = this.data.slice(0, this.checkpontOffset); + const data = this.data.slice(0, this.checkpointOffset); this.reset(); return data; } diff --git a/tracker/tracker/src/webworker/index.ts b/tracker/tracker/src/webworker/index.ts index 271c13f2b..5553610ca 100644 --- a/tracker/tracker/src/webworker/index.ts +++ b/tracker/tracker/src/webworker/index.ts @@ -18,9 +18,9 @@ let pageNo: number = 0; let timestamp: number = 0; let timeAdjustment: number = 0; let nextIndex: number = 0; -// TODO: clear logic: isEmpty here means presense of BatchMeta but absence of other messages +// TODO: clear logic: isEmpty here means presence of BatchMeta but absence of other messages // BatchWriter should be abstracted -let isEmpty: boolean = true; +let isEmpty: boolean = true; function writeBatchMeta(): boolean { // TODO: move to encoder return new BatchMeta(pageNo, nextIndex, timestamp).encode(writer) @@ -56,7 +56,7 @@ function sendBatch(batch: Uint8Array):void { self.postMessage(null); return } - //if (this.response == null) + //if (this.response == null) const nextBatch = sendQueue.shift(); if (nextBatch) { sendBatch(nextBatch); @@ -72,7 +72,7 @@ function sendBatch(batch: Uint8Array):void { return } attemptsCount++; - setTimeout(() => sendBatch(batch), ATTEMPT_TIMEOUT); + setTimeout(() => sendBatch(batch), ATTEMPT_TIMEOUT); } req.send(batch.buffer); } @@ -146,10 +146,10 @@ self.onmessage = ({ data }: MessageEvent) => { } } - writer.checkpoint(); // TODO: incapsulate in writer + writer.checkpoint(); // TODO: encapsulate in writer if (!message.encode(writer)) { send(); - // writer.reset(); // TODO: sematically clear code + // writer.reset(); // TODO: semantically clear code if (!message.encode(writer)) { // Try to encode within empty state // MBTODO: tempWriter for one message? while (!message.encode(writer)) { @@ -163,9 +163,9 @@ self.onmessage = ({ data }: MessageEvent) => { writer = new Writer(beaconSize); writeBatchMeta(); } - } + } }; - nextIndex++; // TODO: incapsulate in writer + nextIndex++; // TODO: encapsulate in writer isEmpty = false; }); };