Asset

Introduced in 4.0.0

Stability: 2 - Stable

The Assert library manages static assets such as JavaScript, CSS, HTML, Images and more. With methods to filter these assets for one time and global use.

const { Asset } = require('kado')

Class Asset

static Asset.getInstance()

Asset.constructor()

Construct a new instance of the Assert library.

Asset.get(mimeType)

Note these assets are registered for all queries and persist until removal.

Asset.getOnce(mimeType)

Note these assets only exist until all() is called with clearOnce set to true

Asset.exists(uri)

Asset.existsOnce(uri)

Asset.nextKey(obj)

Asset.add(uri,mimeType,defer)

Asset.addCss(uri)

Uses the Asset.add() method and automatically sets mime type

Asset.addScript(uri,defer)

Uses the Asset.add() method and automatically sets the mime type while passing the defer argument.

Asset.addOnce(uri,mimeType,defer)

Asset.addCssOnce(uri)

Uses the Asset.addOnce() method and automatically sets mime type

Asset.addScriptOnce(uri,defer)

Uses the Asset.addOnce() method and automatically sets the mime type while passing the defer argument.

Asset.remove(uri)

Asset.removeOnce(uri)

Asset.all(mimeType,clearOnce)