@asset-manager/core
v0.0.5
Published
A singleton for loading and retrieving assets used in your application.
Downloads
6
Maintainers
Readme
@asset-manager/core
This package provides a simple solution for preloading various type of assets and fetching them through a singleton class.
Introduction
Loading and retrieving assets.
import AssetManager from "@asset-manager/core";
import { AudioPlayer } from "@asset-manager/tone";
// Get an instance to the manager and set the loaders
const manager = AssetManager.getInstance();
manager.setLoaders({
audio: AudioPlayer,
});
// Set the assets to load
manager.setAssets([
{
id: "splash",
type: "audio",
url: "splash.mp3",
preload: true,
},
]);
// Elsewhere in your app you can grab assets from the manager
const player = AssetManager.getInstance().get<AudioPlayer>("splash");
Installation
Install this package with npm
.
npm i @asset-manager/core
The core asset manager does not include any 'loaders'. You may want to load an official loader or create your own.
npm i @asset-manager/three