Skip to content

Latest commit

 

History

History
49 lines (41 loc) · 1.76 KB

api_assets.md

File metadata and controls

49 lines (41 loc) · 1.76 KB

Framework documentation

Assets

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" 

assets.load(path)

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))

assets.exists(path)

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))