Members
Methods
addIcon(pIconData) → {Icon|undefined}
Adds an icon to this VYI.
Parameters:
Name | Type | Description |
---|---|---|
pIconData |
Icon
|
Array
|
The icon data to use. |
export(pCompressedopt) → {Object|string}
Exports this VYI into VYI format.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pCompressed |
boolean
|
<optional> |
Whether the data will be compressed. |
Returns:
- Type:
-
Object
|string
Returns the vyi data in either a binary string or an object.
getIcon(pName) → {Icon|undefined}
Gets the icon that has the name pName. The LAST defined icon that has the passed name will be returned.
Parameters:
Name | Type | Description |
---|---|---|
pName |
string
|
The name of the icon to get. |
getIconById(pId) → {Icon}
Gets an icon by the id provided.
Parameters:
Name | Type | Description |
---|---|---|
pId |
string
|
The id of the icon. |
getIconCount() → {number}
Gets the number of icons this vyi has.
Returns:
- Type:
-
number
The amount of icons this vyi has.
getIconNames() → {Array}
Returns all the icon names in this vyi.
Returns:
- Type:
-
Array
An array of icon names in this vyi.
getName() → {string}
Gets the name of the vyi.
Returns:
- Type:
-
string
The name of the vyi.
(async) parse(pVyiData) → {Promise.<void>}
Parses the provided VYI data (either a URL, a JSON object, or binary data) and processes it.
If the data is a URL (string), it fetches/reads the data and parses it as JSON.
If the data is binary, it attempts to inflate it using pako or decode it as plain text.
Parameters:
Name | Type | Description |
---|---|---|
pVyiData |
string
|
Object
|
Uint8Array
|
ArrayBuffer
|
The VYI data to parse. Or a path to a VYI file. |
Throws:
-
- Throws an error if fetching, inflating, or decoding fails.
- Type
-
Error
Returns:
- Type:
-
Promise.<void>
- A promise that resolves when the parsing is completed.
readFile(pVyiData) → {Promise.<VYI>}
Read the file from a binary string.
Parameters:
Name | Type | Description |
---|---|---|
pVyiData |
string
|
The compressed binary string representing the vyi data. |
removeIcon(pIcon)
Removes the icon passed.
Parameters:
Name | Type | Description |
---|---|---|
pIcon |
Icon
|
The icon to remove from this vyi. |
removeIconById(pName)
Removes the icon via it's id.
Parameters:
Name | Type | Description |
---|---|---|
pName |
string
|
The id to use to find the icon. |
removeIconByName(pName)
Removes the icon via it's name. The LAST defined icon that has the passed name will be removed. As names are not unique.
Parameters:
Name | Type | Description |
---|---|---|
pName |
string
|
The name to use to find the icon. |