0.0.5 • Published 3 years ago

@asset-manager/core v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@asset-manager/core

NPM version Actions Status PR Welcome

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
0.0.5

3 years ago

0.0.3

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago