Namespace: extensions

extensions

extensions is a global object that holds all the extensions registered with PixiJS. PixiJS uses a this extensions architecture a lot to make the library more modular and flexible.

For example, if you want to add load a new type of asset, you can register a new LoaderParser with the extensions object.

import { extensions, ExtensionType } from 'pixi.js';

// create a custom asset loader
const customAssetLoader = {
   extension: {
       type: ExtensionType.LoadParser,
       name: 'custom-asset-loader',
   },
   test(url) {
      // check if this new loader should be used...
   },
   load(url) {
       // load the asset...
   },
};

// add the custom asset loader to pixi
extensions.add(customAssetLoader);

This would add the customAssetLoader to the list of available loaders that PixiJS can use.

There are many different types of extensions, which are listed in ExtensionType.

Interface Definitions

ExtensionFormat

Format when registering an extension. Generally, the extension should have these values as extension static property, but you can override name or type by providing an object.

Properties:
Name Type Description
name string

Optional. Some plugins provide an API name/property, such as Renderer plugins

priority number

Optional, used for sorting the plugins in a particular order

ref any

Reference to the plugin object/class

type ExtensionType | ExtensionType[]

The extension type, can be multiple types

Members

extensions readonly

Global registration of all PixiJS extensions. One-stop-shop for extensibility.

Import the extensions object and use it to register new functionality via the described methods below.

import { extensions } from 'pixi.js';

// register a new extension
extensions.add(myExtension);
Properties:
Name Type Description
add Function

Register new extensions with PixiJS.

handle Function

Internal method to handle extensions by name.

handleByList Function

Handle a type, but using a list of extensions.

handleByMap Function

Handle a type, but using a map by name property.

handleByNamedList Function

Handle a type, but using a list of extensions with a name property.

remove Function

Remove extensions from PixiJS.

Enums

ExtensionType

Collection of valid extension types.

Properties:
Name Description
Application

extensions that are registered as Application plugins

Asset

extensions that combine the other Asset extensions

BlendMode

A type of extension for creating a new advanced blend mode

CacheParser

extensions that are used to handle how urls are cached by Assets

CanvasPipes

extensions that are registered as Canvas render systems

CanvasPipesAdaptor

extensions that are registered as Canvas render pipes adaptors

CanvasSystem

extensions that are registered as Canvas render pipes

DetectionParser

extensions that are used to add/remove available resources from Assets

Environment

A type of extension that will be used to auto detect an environment

LoadParser

extensions that are used to load assets through Assets

MaskEffect

extensions that are registered with the MaskEffectManager

ResolveParser

extensions that are used to resolve asset urls through Assets

ShapeBuilder

A type of extension for building and triangulating custom shapes used in graphics.

TextureSource

A type of extension that will be used to auto detect a resource type

WebGLPipes

extensions that are registered as WebGL render pipes

WebGLPipesAdaptor

extensions that are registered as WebGL render pipes adaptors

WebGLSystem

extensions that are registered as WebGL render systems

WebGPUPipes

extensions that are registered as WebGPU render pipes

WebGPUPipesAdaptor

extensions that are registered as WebGPU render pipes adaptors

WebGPUSystem

extensions that are registered as WebGPU render systems

Type Definitions

ExtensionMetadata

The metadata for an extension.