🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@pixi/extensions

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/extensions - npm Package Compare versions

Comparing version

to
7.0.5

3

lib/index.d.ts

@@ -99,7 +99,8 @@ /**

* @param list - The list of extensions.
* @param defaultPriority - The default priority to use if none is specified.
* @returns {PIXI.extensions} For chaining.
*/
handleByList(type: ExtensionType, list: any[]): any;
handleByList(type: ExtensionType, list: any[], defaultPriority?: number): any;
};
export { extensions, ExtensionType, };
export type { ExtensionHandler, ExtensionMetadata, ExtensionFormatLoose, ExtensionFormat, };

@@ -21,2 +21,5 @@ 'use strict';

if (typeof ext === "function" || typeof ext === "object" && ext.extension) {
if (!ext.extension) {
throw new Error("Extension class must have an extension object");
}
const metadata = typeof ext.extension !== "object" ? { type: ext.extension } : ext.extension;

@@ -35,2 +38,3 @@ ext = { ...metadata, ref: ext };

};
const normalizePriority = (ext, defaultPriority) => normalizeExtension(ext).priority ?? defaultPriority;
const extensions = {

@@ -64,2 +68,5 @@ _addHandlers: {},

const removeHandlers = this._removeHandlers;
if (addHandlers[type] || removeHandlers[type]) {
throw new Error(`Extension type ${type} already has a handler`);
}
addHandlers[type] = onAdd;

@@ -81,3 +88,3 @@ removeHandlers[type] = onRemove;

},
handleByList(type, list) {
handleByList(type, list, defaultPriority = -1) {
return this.handle(type, (extension) => {

@@ -88,3 +95,3 @@ if (list.includes(extension.ref)) {

list.push(extension.ref);
list.sort((a, b) => (b.priority ?? -1) - (a.priority ?? -1));
list.sort((a, b) => normalizePriority(b, defaultPriority) - normalizePriority(a, defaultPriority));
}, (extension) => {

@@ -91,0 +98,0 @@ const index = list.indexOf(extension.ref);

{
"name": "@pixi/extensions",
"version": "7.0.4",
"version": "7.0.5",
"main": "lib/index.js",

@@ -22,7 +22,7 @@ "module": "lib/index.mjs",

"homepage": "http://pixijs.com/",
"bugs": "https://github.com/pixijs/pixi.js/issues",
"bugs": "https://github.com/pixijs/pixijs/issues",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/pixijs/pixi.js.git"
"url": "https://github.com/pixijs/pixijs.git"
},

@@ -36,3 +36,3 @@ "publishConfig": {

],
"gitHead": "1d0f4da7abd7238a440f78b3661e40ced1a27614"
"gitHead": "8a89713515f9dbe298484120429202534ac1f9f7"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet