UNPKG

@playcanvas/react

Version:

A React renderer for PlayCanvas – build interactive 3D applications using React's declarative paradigm.

35 lines (34 loc) 1.1 kB
import { Application, Asset } from "playcanvas"; export type AssetMeta = { /** * The normalized progress of the asset loading. */ progress: number; } & Record<string, unknown>; export type FetchAssetOptions = { /** * The PlayCanvas application instance. When loading an asset it will be scoped to this application. * The asset can't be re-used across different applications. */ app: Application; /** * The URL of the asset to fetch. */ url: string; /** * The type of the asset to fetch. */ type: string; /** * Props passed to the asset. This is spread into the `file` `data` and `options` properties of the asset. * @defaultValue {} */ props?: Record<string, unknown>; /** * A callback function that is called to provide loading progress. * @param {AssetMeta} meta - The progress of the asset loading. * @returns void */ onProgress?: (meta: AssetMeta) => void; }; export declare const fetchAsset: ({ app, url, type, props, onProgress }: FetchAssetOptions) => Promise<Asset>;