Class: ImageGenerator

hcje/images.ImageGenerator()

Class for an image generator. This can create data urls for automatically generated images.

Constructor

new ImageGenerator()

Source:

Methods

createObjectUrl(config) → {Promise}

Create an object URL for an automatically generated image.

Parameters:
Name Type Description
config module:hcje/images~ImageConfig

Image configuration.

Source:
Returns:

Fulfils to a string containing a blob URL. Blob

Type
Promise

createObjectUrlOrUseCache(cacheId, config) → {Promise}

Create an object URL for an automatically generated image. If the image has been previously cached, the cached version is returned and a new image is NOT returned.

Parameters:
Name Type Description
cacheId string

ID of the image held in a cache for future retrieval or revocation.

config module:hcje/images/ImageConfig

Image configuration.

Source:
Returns:

Fulfils to a string containing a blob URL. Blob

Type
Promise

revokeAll()

Revoke all cached urls and clear the cache.

Source:

revokeCacheId(cacheId)

Revoke a previously cached data url and remove from the cache.

Parameters:
Name Type Description
cacheId string

ID of the cached image.

Source: