app.res
Access to current stage's resources including style. Unlike NetworkInterface, the downloaded resources will be mapped accordingly.
#
ConstantsName | Type | Description |
---|---|---|
url | string | URL of current stage's resource. |
style | object | Provides access to style.varl . |
#
MethodsName | Return Type | Description |
---|---|---|
loadIcon | Promise<ImageBitmapSource> | Get app or stage specific icon, asynchronously. |
loadPicture | Promise<ImageBitmapSource> | Get app or stage specific picture, asynchronously. |
loadFont | Promise<Font> | Get app or stage specific font, asynchronously. |
#
loadIconGet app or stage specific icon, asynchronously. Only accept SVG format, otherwise error occured. The reason of separating SVG as icon because we have to draw icon with vector instead of bitmap. Thus, better load time, performance, and scalibility. The icon should be simple as stated on Material Design specification.
Parameters:
- name: (string type) Icon name, without
.svg
suffix.
Return: Promise<ImageBitmapSource>. Use .then(icon => { your code here })
to get the icon.
Throw: NetworkException. Use .catch(error => { your code here })
to get the error code and message.
#
loadPictureGet app or stage specific picture, asynchronously. Supported format: JPEG, PNG, GIF, TIFF, and BMP.
Parameters:
- name: (string type) Picture name, without extension suffix (e.g.
.jpg
,.png
, ...). - extension: (string type, optional) Extension suffix. Default value is
.jpg
.
Return: Promise<ImageBitmapSource>. Use .then(picture => { your code here })
to get the picture.
Throw: NetworkException. Use .catch(error => { your code here })
to get the error code and message.
#
loadFontGet app or stage specific font, asynchronously. Supported format: TTF, OTF, and WOFF.
Parameters:
- name: (string type) Font file name, without extension suffix (e.g.
.ttf
,.otf
, ...). - extension: (string type, optional) Extension suffix. Default value is
.ttf
.
Return: Promise<ImageBitmapSource>. Use .then(fontObject => { your code here })
to get the font.
Throw: NetworkException. Use .catch(error => { your code here })
to get the error code and message.