@pixi/events
This packages implements the Federated Events API, the plumbing behind the propagation of UI events into the PixiJS
scene graph.
Installation
npm install @pixi/events
Usage
import { extensions, Application, InteractionManager } from 'pixi.js';
import { EventSystem } from '@pixi/events';
extensions.remove(InteractionManager);
const app = new Application();
const { renderer } = app;
document.body.appendChild(app.view);
renderer.addSystem(EventSystem, 'events');
stage.addEventListener('click', function handleClick()
{
console.log('Hello world!');
});
renderer.render(stage);
renderer.view.dispatchEvent(new PointerEvent('click', {
pointerType: 'mouse',
clientX: 1,
clientY: 1,
isPrimary: true,
}));