mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-09 17:19:59 +00:00
TSLint compliance
This commit is contained in:
@@ -35,7 +35,7 @@ export default async function loadSender (opts: LoadSenderOptions) {
|
||||
const shim = ShimManager.getShim(opts.tabId, opts.frameId);
|
||||
if (!shim) {
|
||||
throw logger.error(`Shim not found at tabId ${
|
||||
opts.tabId} / frameId ${opts.frameId}`)
|
||||
opts.tabId} / frameId ${opts.frameId}`);
|
||||
}
|
||||
|
||||
shim.contentPort.postMessage({
|
||||
|
||||
@@ -3,15 +3,17 @@
|
||||
export class Logger {
|
||||
constructor (private prefix: string) {}
|
||||
|
||||
log (message: string, data?: any) {
|
||||
public log (message: string, data?: any) {
|
||||
const formattedMessage = `${this.prefix} (Log): ${message}`;
|
||||
if (data) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log(formattedMessage, data);
|
||||
} else {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log(formattedMessage);
|
||||
}
|
||||
}
|
||||
info (message: string, data?: any) {
|
||||
public info (message: string, data?: any) {
|
||||
const formattedMessage = `${this.prefix} (Info): ${message}`;
|
||||
if (data) {
|
||||
console.info(formattedMessage, data);
|
||||
@@ -19,7 +21,7 @@ export class Logger {
|
||||
console.info(formattedMessage);
|
||||
}
|
||||
}
|
||||
error (message: string, data?: any) {
|
||||
public error (message: string, data?: any) {
|
||||
const formattedMessage = `${this.prefix} (Error): ${message}`;
|
||||
if (data) {
|
||||
console.error(formattedMessage, data);
|
||||
|
||||
@@ -107,7 +107,7 @@ export default new class extends TypedEventTarget<EventMap> {
|
||||
* Returns storage promise.
|
||||
*/
|
||||
public async setAll (options: Options): Promise<void> {
|
||||
return storageArea.set({ options })
|
||||
return storageArea.set({ options });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@ export class TypedStorageArea<Schema extends { [key: string]: any }> {
|
||||
/**
|
||||
* Retrieves one or more items from the storage area.
|
||||
*
|
||||
* @param keys -
|
||||
* @param keys -
|
||||
* A string, array of strings or partial schema object
|
||||
* (with default values) indicating which keys to retrieve
|
||||
* from storage.
|
||||
@@ -24,7 +24,7 @@ export class TypedStorageArea<Schema extends { [key: string]: any }> {
|
||||
public async get<SchemaKey extends keyof Schema
|
||||
, SchemaPartial extends Partial<Schema>> (
|
||||
keys?: SchemaKey
|
||||
| Array<SchemaKey>
|
||||
| SchemaKey[]
|
||||
| SchemaPartial
|
||||
| null | undefined)
|
||||
: Promise<Pick<Schema, Extract<
|
||||
@@ -37,12 +37,12 @@ export class TypedStorageArea<Schema extends { [key: string]: any }> {
|
||||
* Gets the amount of storage space — in bytes — used by one
|
||||
* or more items in the storage area.
|
||||
*
|
||||
* @param keys -
|
||||
* @param keys -
|
||||
* A string or array of strings indicating the keys of
|
||||
* which to get the storage space.
|
||||
*/
|
||||
public async getBytesInUse<SchemaKey extends keyof Schema> (
|
||||
keys?: Schema | Array<SchemaKey>): Promise<number> {
|
||||
keys?: Schema | SchemaKey[]): Promise<number> {
|
||||
|
||||
return await this.storageArea.getBytesInUse(keys);
|
||||
}
|
||||
@@ -61,12 +61,12 @@ export class TypedStorageArea<Schema extends { [key: string]: any }> {
|
||||
/**
|
||||
* Removes one or more items from the storage area.
|
||||
*
|
||||
* @param keys -
|
||||
* @param keys -
|
||||
* A string or array of strings indicating which keys to
|
||||
* remove from storage.
|
||||
*/
|
||||
public async remove<SchemaKey extends keyof Schema> (
|
||||
keys: SchemaKey | Array<SchemaKey>): Promise<void> {
|
||||
keys: SchemaKey | SchemaKey[]): Promise<void> {
|
||||
|
||||
await this.storageArea.remove(keys);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ const PLATFORM_WIN = "Windows NT 10.0; Win64; x64";
|
||||
const PLATFORM_LINUX = "X11; Linux x86_64";
|
||||
|
||||
const UA_CHROME = "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36";
|
||||
const UA_HYBRID = "Chrome/80.0.3987.87 Gecko/20100101 Firefox/72.0"
|
||||
const UA_HYBRID = "Chrome/80.0.3987.87 Gecko/20100101 Firefox/72.0";
|
||||
|
||||
export function getChromeUserAgent(platform: string, hybrid = false) {
|
||||
export function getChromeUserAgent (platform: string, hybrid = false) {
|
||||
let platformComponent: string;
|
||||
if (platform === "mac") {
|
||||
platformComponent = hybrid
|
||||
|
||||
Reference in New Issue
Block a user