Options
All
  • Public
  • Public/Protected
  • All
Menu

External module chrome/utils

Utility methods

If you want to log events, errors, etc. locally during development, save a boolean key/value pair: isDevelopmentBuild: true to local storage

Index

Variables

Const DEBUG

DEBUG: boolean = ChromeStorage.get('isDevelopmentBuild', false)

True if development build

Const chromep

chromep: ChromePromise = new ChromePromise()

Functions

checkNetworkConnection

  • checkNetworkConnection(): void
  • Check for internet connection

    remarks

    Throw an error if LAN is not connected

    This will at least ensure the LAN is connected. May get false positives for other errors.

    throws

    An error if no internet connection

    Returns void

getChromeVersion

  • getChromeVersion(): number

getExtensionName

  • getExtensionName(): string
  • Get the extension's name

    Returns string

getFullChromeVersion

  • getFullChromeVersion(): string
  • Get the full Chrome version https://goo.gl/2ITMNO

    Returns string

    Chrome version

getPlatformOS

  • getPlatformOS(): Promise<string>
  • Get the OS as a human readable string

    Returns Promise<string>

getRandomFloat

  • getRandomFloat(min: number, max: number): number
  • Returns a random float between min and max inclusive min, exclusive max

    Parameters

    • min: number

      min value

    • max: number

      max value

    Returns number

    A pseudo-random float

getRandomInt

  • getRandomInt(min: number, max: number): number
  • Returns a random integer between min and max inclusive

    Parameters

    • min: number

      min value

    • max: number

      max value

    Returns number

    A pseudo-random int

getRandomString

  • getRandomString(len?: number): string
  • Get a random string of the given length

    Parameters

    • Default value len: number = 8

      length of generated string

    Returns string

    A pseudo-random string

getVersion

  • getVersion(): string
  • Get the extension's version

    Returns string

isChromeOS

  • isChromeOS(): Promise<boolean>
  • Determine if we are Chrome OS

    Returns Promise<boolean>

isMac

  • isMac(): Promise<boolean>
  • Determine if we are Mac

    Returns Promise<boolean>

isOS

  • isOS(os: string): Promise<boolean>
  • Determine if we are a given operating system

    Parameters

    • os: string

      os short name

    Returns Promise<boolean>

    true if the given os

isWhiteSpace

  • isWhiteSpace(str: string | null | undefined): boolean
  • Determine if a String is null or whitespace only

    Parameters

    • str: string | null | undefined

      string to check

    Returns boolean

    true is str is whitespace or null

isWindows

  • isWindows(): Promise<boolean>
  • Determine if we are MS windows

    Returns Promise<boolean>

noop

  • noop(): void
  • No operation

    Returns void

shuffleArray

  • shuffleArray<T>(array: T[]): void
  • Randomly sort an Array in place

    remarks

    Fisher-Yates shuffle algorithm.

    Type parameters

    • T

    Parameters

    • array: T[]

      Array to sort

    Returns void

wait

  • wait(time: number): Promise<void>
  • Wait for the specified time

    Parameters

    • time: number

      wait time in milliSecs

    Returns Promise<void>

Generated using TypeDoc