Constructor
new Asset(options)
Create a new Asset with the specified options
Parameters:
Name | Type | Description |
---|---|---|
options |
object | The options object for the Asset - see below |
Example
const { Asset } = require('tenkai')
var asset = new Asset({
name: 'tilesAsset',
src: 'assets/tileset.png'
})
Methods
load(callback)
Load the Asset asynchronously from its src and optionally trigger the supplied callback when available.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
callback |
function | null | The callback function to invoke when the asset has been loaded |
Example
asset.load((err, as) => {
console.log("Asset "+as.name+" Loaded")
})