Options
All
  • Public
  • Public/Protected
  • All
Menu

Module util

fileoverview

Utility functions for the tensorflow graph visualizer.

Index

Variables

ASYNC_TASK_DELAY

ASYNC_TASK_DELAY: 20 = 20

Recommended delay (ms) when running an expensive task asynchronously that gives enough time for the progress bar to update its UI.

Functions

escapeQuerySelector

  • escapeQuerySelector(querySelector: string): string
  • Returns a query selector with escaped special characters that are not allowed in a query selector.

    Parameters

    • querySelector: string

    Returns string

getQueryParams

  • getQueryParams(queryString: string): any
  • Given a queryString, aka ?foo=1&bar=2, return the object representation.

    Parameters

    • queryString: string

    Returns any

getSubtaskTracker

  • Creates a tracker for a subtask given the parent tracker, the total progress of the subtask and the subtask message. The parent task should pass a subtracker to its subtasks. The subtask reports its own progress which becames relative to the main task.

    Parameters

    • parentTracker: ProgressTracker
    • impactOnTotalProgress: number
    • subtaskMsg: string

    Returns ProgressTracker

getTracker

  • getTracker(polymerComponent: any): object
  • Creates a tracker that sets the progress property of the provided polymer component. The provided component must have a property called 'progress' that is not read-only. The progress property is an object with a numerical 'value' property and a string 'msg' property.

    Parameters

    • polymerComponent: any

    Returns object

    • reportError: function
      • reportError(msg: string, err: any): void
      • Parameters

        • msg: string
        • err: any

        Returns void

    • setMessage: function
      • setMessage(msg: any): void
      • Parameters

        • msg: any

        Returns void

    • updateProgress: function
      • updateProgress(value: any): void
      • Parameters

        • value: any

        Returns void

removeCommonPrefix

  • removeCommonPrefix(strings: string[]): Array<string>
  • Given a list of strings, it returns a new list of strings with the longest common prefix removed. If the common prefix is one of the strings in the list, it returns the original strings.

    Parameters

    • strings: string[]

    Returns Array<string>

runAsyncPromiseTask

  • runAsyncPromiseTask<T>(msg: string, incProgressValue: number, task: function, tracker: ProgressTracker): Promise<T>
  • Asynchronously runs an expensive task that returns a promise. Updates the tracker's progress after the promise resolves. Returns a new promise that resolves after the progress is updated.

    Type parameters

    • T

    Parameters

    • msg: string
    • incProgressValue: number
    • task: function
        • (): Promise<T>
        • Returns Promise<T>

    • tracker: ProgressTracker

    Returns Promise<T>

runAsyncTask

  • runAsyncTask<T>(msg: string, incProgressValue: number, task: function, tracker: ProgressTracker): Promise<T>
  • Runs an expensive task asynchronously and returns a promise of the result.

    Type parameters

    • T

    Parameters

    • msg: string
    • incProgressValue: number
    • task: function
        • (): T
        • Returns T

    • tracker: ProgressTracker

    Returns Promise<T>

runTask

  • runTask<T>(msg: string, incProgressValue: number, task: function, tracker: ProgressTracker): T
  • Runs an expensive task and return the result.

    Type parameters

    • T

    Parameters

    • msg: string
    • incProgressValue: number
    • task: function
        • (): T
        • Returns T

    • tracker: ProgressTracker

    Returns T

time

  • time<T>(msg: string, task: function): T
  • Type parameters

    • T

    Parameters

    • msg: string
    • task: function
        • (): T
        • Returns T

    Returns T

Generated using TypeDoc