Skip to main content

Utils

Constructors

new Utils()

new Utils(): Utils

Returns

Utils

Methods

download()

static download(filename, content, contentType?): void

Downloads the specified content locally

Parameters

ParameterType
filenamestring
contentBlobPart
contentType?string

Returns

void

Source

src/utils.ts:193


firstOrNull()

static firstOrNull<T>(iterable): null | T

Type parameters

Type parameter
T

Parameters

ParameterTypeDescription
iterableIterable<T>

Returns

null | T

Source

src/utils.ts:141


identity()

static identity(length): Uint32Array

Returns an 'identity' array where the element in idx-th position is equals to idx.

Parameters

ParameterType
lengthnumber

Returns

Uint32Array

Source

src/utils.ts:147


isEmpty()

static isEmpty(s?): boolean

Parameters

ParameterType
s?string

Returns

boolean

Source

src/utils.ts:158


loadJsCss()

static loadJsCss(files): Promise<null>

Loads the specified common libraries, if they were not loaded already. Use it in plugins when a big JS dependency is used infrequently, such as exporting to Excel, or showing a 3d structure. Example: loadJsCss(['common/exceljs.min.js', 'common/exceljs.min.css'])

Parameters

ParameterType
filesstring[]

Returns

Promise<null>

Source

src/utils.ts:206


nullIfEmpty()

static nullIfEmpty(s?): undefined | null | string

Parameters

ParameterType
s?string

Returns

undefined | null | string

Source

src/utils.ts:162


openFile()

static openFile(options): void

Shows "Open File" dialog, and lets you process the result.

Parameters

ParameterType
optionsobject
options.acceptstring
options.open(file) => void

Returns

void

Source

src/utils.ts:167


openFileBytes()

static openFileBytes(options): void

Shows "Open File" dialog, and lets you process the result.

Parameters

ParameterType
optionsobject
options.acceptstring
options.open(bytes) => void

Returns

void

Source

src/utils.ts:179


replaceAll()

static replaceAll(string, search, replace): string

Parameters

ParameterType
stringstring
searchstring
replacestring

Returns

string

Source

src/utils.ts:154


streamToObservable()

static streamToObservable<T>(dartStream): Observable<T>

Type parameters

Type parameterValue
Tany

Parameters

ParameterType
dartStreamany

Returns

Observable<T>

Source

src/utils.ts:210