Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@pixi/extensions

Package Overview
Dependencies
Maintainers
2
Versions
51
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 7.1.0-alpha to 7.1.0

5

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, };
export type { ExtensionFormat, ExtensionFormatLoose, ExtensionHandler, ExtensionMetadata, };

11

lib/index.js

@@ -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.1.0-alpha",
"version": "7.1.0",
"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": "0fb26a500c738cb550da277c112d15d9dd3f87b6"
"gitHead": "4079e92895ecb692afe9f0b15d3e48ee40852ada"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc