Class: Utils
dg.Utils
Constructors
constructor
• new Utils()
Methods
download
▸ Static
download(filename
, content
, contentType?
): void
Downloads the specified content locally
Parameters
Name | Type |
---|---|
filename | string |
content | BlobPart |
contentType? | string |
Returns
void
Defined in
firstOrNull
▸ Static
firstOrNull<T
>(iterable
): null
| T
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
iterable | Iterable <T > |
Returns
null
| T
Defined in
identity
▸ Static
identity(length
): Uint32Array
Returns an 'identity' array where the element in idx-th position is equals to idx.
Parameters
Name | Type |
---|---|
length | number |
Returns
Uint32Array
Defined in
isEmpty
▸ Static
isEmpty(s?
): boolean
Parameters
Name | Type |
---|---|
s? | string |
Returns
boolean
Defined in
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
Name | Type |
---|---|
files | string [] |
Returns
Promise
<null
>
Defined in
nullIfEmpty
▸ Static
nullIfEmpty(s?
): undefined
| null
| string
Parameters
Name | Type |
---|---|
s? | string |
Returns
undefined
| null
| string
Defined in
openFile
▸ Static
openFile(options
): void
Shows "Open File" dialog, and lets you process the result.
Parameters
Name | Type |
---|---|
options | Object |
options.accept | string |
options.open | (file : File ) => void |
Returns
void
Defined in
openFileBytes
▸ Static
openFileBytes(options
): void
Shows "Open File" dialog, and lets you process the result.
Parameters
Name | Type |
---|---|
options | Object |
options.accept | string |
options.open | (bytes : Uint8Array ) => void |
Returns
void
Defined in
replaceAll
▸ Static
replaceAll(string
, search
, replace
): string
Parameters
Name | Type |
---|---|
string | string |
search | string |
replace | string |
Returns
string