Utility functions for working with icons and associated HTML.
- Description:
Utility functions for working with icons and associated HTML.
- Source:
Methods
(static) toCssClass(uri) → {String}
- Description:
Convert the URI to a usable CSS class, expected to be represented in the
spritesheet CSS for that module.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
uri |
String |
Returns:
- Type
- String
(static) toElements(icon, syncopt) → {Promise.<Array.<HTMLSpanElement>>}
- Description:
Just like
toHtml, but resolves an array of raw Elements instead.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
icon |
String | baja.Ord | Array.<(String|baja.Ord)> | baja.Icon | |||
sync |
boolean |
<optional> |
false
|
set to true to wait for the image to finish |
Returns:
to be resolved with an array of
span elements
- Type
- Promise.<Array.<HTMLSpanElement>>
(static) toHtml(icon, syncopt) → {Promise.<string>}
- Description:
Given an icon value (string,
baja.Icon, etc), convert it into a usable
HTML snippet.The HTML will consist of a one or more
spantags. Eachspanwill have
oneimgelement. If the icon is accounted for in a spritesheet, the
imgtag will be hidden and the icon will be represented solely by the
spanusing pure CSS. If the icon is not in a spritesheet, theimg
tag will be shown and have itssrctag set to the raw icon image.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
icon |
String | baja.Ord | Array.<(String|baja.Ord)> | baja.Icon | |||
sync |
boolean |
<optional> |
false
|
set to true to wait for the image to finish |
Returns:
promise to be resolved with a raw HTML string containing
one or more span tags
- Type
- Promise.<string>
(static) toUris(icon) → {Array.<String>}
- Description:
Convert a value to an array of image URIs.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
icon |
String | baja.Ord | Array.<(String|baja.Ord)> | baja.Icon | a string |
Throws:
-
if invalid input given
- Type
- Error
Returns:
array of image URIs
- Type
- Array.<String>