@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 { Renderer } from '@pixi/core';
import { Application } from '@pixi/app';
import { EventSystem } from '@pixi/events';
delete Renderer.__plugins.interaction;
const app = new PIXI.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,
}));