0.1.1 • Published 1 year ago

@h1ve2/pixi-canvaspool v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@h1ve2/pixi-canvaspool

Used to fix the resource restriction issue of PIXI in browsers such as Safari 11 that do not support Imagebitmap.

It can effectively avoid the situation where getContent ("2d") is null when using a large number of image resources.

After import, CanvasPool will automatically inject DOMAdapter.get().createCanvas()

Need to manually call destroy or destroyBundle to destroy the corresponding resource and release the canvas

Usage

npm install "@h1ve2/pixi-canvaspool"
// yarn add "@h1ve2/pixi-canvaspool"

Use Bundle (recommended)

import {CanvasPool} from "@h1ve2/pixi-canvaspool"
...

CanvasPool.destroyBundle(bundleId); // Proactively call to release canvas before uninstalling the resource group
Assets.unloadBundle(bundleId);
...

Use url

import {CanvasPool} from "@h1ve2/pixi-canvaspool"
...
CanvasPool.destroy(url);
Assets.unload(url)
...
0.1.1

1 year ago

0.1.0

1 year ago