Appearance
Export and import scripts / Hm05Script / ImportApi
Interface: ImportApi
Properties
| Property | Type | Description |
|---|---|---|
build | object | what the import adds (applied together when run() ends) |
build.image | (spec) => string | a Library picture; returns a handle for elements |
build.markerType | (spec) => string | a marker type (skipped when one of that name exists); returns the name markers use |
build.symbol | (spec) => string | a Library symbol; returns its (unique) name |
doc | object | the open document, read only |
doc.fps | number | - |
doc.markerTypes | () => MarkerTypeInfo[] | - |
doc.symbols | () => string[] | Library symbol names |
files | object | Other files, by a path relative to the picked file's folder ("../pics/a.png") — or absolute on the desktop. Reading outside the picked file's folder asks the user first (desktop); the browser asks the user to pick the folder that holds them. |
files.exists | (path) => Promise<boolean> | - |
files.read | (path) => Promise<Uint8Array<ArrayBufferLike>> | - |
files.text | (path, encoding?) => Promise<string> | - |
image | object | picture helpers |
image.size | (bytes) => Promise<{ height: number; width: number; }> | width / height of PNG / JPEG / GIF / WebP bytes |
input | object | the file the user picked |
input.name | string | - |
input.path | string | null | the full path on the desktop; null in the browser |
input.size | number | - |
input.bytes | () => Promise<Uint8Array<ArrayBufferLike>> | - |
input.text | (encoding?) => Promise<string> | decoded text (default utf-8) |
Methods
log()
ts
log(...values): void;shown in the dialog's log (console.log does the same)
Parameters
| Parameter | Type |
|---|---|
...values | unknown[] |
Returns
void
progress()
ts
progress(done, total): void;the dialog shows done / total
Parameters
| Parameter | Type |
|---|---|
done | number |
total | number |
Returns
void