- Installation
- aj: command line interface
- API
- Native API
- Implementing Flux
- Assets <-
- Storage
- HTTP
- Plugins
- Debugging
Assets management API are contained in aj/assets
js module.
In order to use assets api in your code, use import
keyword
import * as assets from "./aj/assets"
Load an asset from device assets. Returns a promise of result Result contains buffer id of downloaded data.
Example:
assets.load("values.json")
.then(bufferId => buffers.get(bufferId))
.then(data => console.log(data))
.catch(e => logger.e(e))
Check assets existence. Returns a promise of result
Example:
assets.exists("values.json")
.then(result => {
if (result) {
console.log("values.json exists")
} else {
console.log("values.json not exists")
}
})
.catch(e => logger.e(e))