Socket
Socket
Sign inDemoInstall

@pixi/runner

Package Overview
Dependencies
Maintainers
2
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/runner - npm Package Compare versions

Comparing version 7.3.3 to 7.4.0

67

lib/Runner.d.ts

@@ -0,1 +1,8 @@

export type RunnerListenerCallback<ARG extends unknown[] = any[]> = (...args: ARG) => unknown;
type RunnerItemValid<T extends string, ARG extends unknown[] = any[]> = {
[K in T]: RunnerListenerCallback<ARG> | unknown;
};
type RunnerItemAny = Record<string, unknown>;
type RunnerItemEmpty = Record<string, never>;
export type RunnerItem<T = string, ARG extends unknown[] = any[]> = T extends string ? RunnerItemValid<T, ARG> & RunnerItemAny | RunnerItemEmpty : unknown;
/**

@@ -44,5 +51,46 @@ * A Runner is a highly performant and simple alternative to signals. Best used in situations

* ```
*
* Type safety:
*
* ```ts
*
* import { Runner } from '@pixi/runner';
*
* let runner: Runner<'update', [number]>;
*
* // This won't work because the function name 'update' is expected
* runner = new Runner('destroy');
*
* // This is fine
* runner = new Runner('update');
*
* // This won't work because the number is expected
* runner.emit("10");
*
* // This is fine
* runner.emit(10);
*
* // This won't work because provided object does not contain 'update' key
* runner.add({
* destroy: function() {
* // Destroy the game
* },
* });
*
* // This is fine
* runner.add({
* update: function(time) {
* // Update my gamey state
* },
* destroy: function() {
* // Destroy the game
* },
* });
*
* ```
* @template T - The event type.
* @template ARG - The argument types for the event handler functions.
* @memberof PIXI
*/
export declare class Runner {
export declare class Runner<T = any, ARG extends unknown[] = any[]> {
items: any[];

@@ -52,5 +100,5 @@ private _name;

/**
* @param name - The function name that will be executed on the listeners added to this Runner.
* @param {string} name - The function name that will be executed on the listeners added to this Runner.
*/
constructor(name: string);
constructor(name: T);
/**

@@ -60,3 +108,3 @@ * Dispatch/Broadcast Runner to all listeners added to the queue.

*/
emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown, a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this;
emit(a0?: ARG[0], a1?: ARG[1], a2?: ARG[2], a3?: ARG[3], a4?: ARG[4], a5?: ARG[5], a6?: ARG[6], a7?: ARG[7]): this;
private ensureNonAliasedItems;

@@ -81,3 +129,3 @@ /**

*/
add(item: unknown): this;
add(item: RunnerItem<T, ARG>): this;
/**

@@ -87,3 +135,3 @@ * Remove a single listener from the dispatch queue.

*/
remove(item: unknown): this;
remove(item: RunnerItem<T, ARG>): this;
/**

@@ -93,3 +141,3 @@ * Check to see if the listener is already in the Runner

*/
contains(item: unknown): boolean;
contains(item: RunnerItem<T, ARG>): boolean;
/** Remove all listeners from the Runner */

@@ -106,5 +154,6 @@ removeAll(): this;

* The name of the runner.
* @readonly
* @type {string}
*/
get name(): string;
get name(): T;
}
export {};

6

lib/Runner.js
"use strict";
class Runner {
/**
* @param name - The function name that will be executed on the listeners added to this Runner.
* @param {string} name - The function name that will be executed on the listeners added to this Runner.
*/

@@ -69,3 +69,3 @@ constructor(name) {

destroy() {
this.removeAll(), this.items = null, this._name = null;
this.removeAll(), this.items.length = 0, this._name = "";
}

@@ -81,3 +81,3 @@ /**

* The name of the runner.
* @readonly
* @type {string}
*/

@@ -84,0 +84,0 @@ get name() {

{
"name": "@pixi/runner",
"version": "7.3.3",
"version": "7.4.0",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "module": "lib/index.mjs",

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