LogoPixi’VN
indexFunctions

Function: eventDecorator()

> eventDecorator(name?): (_target, propertyKey, descriptor) => void

Defined in: src/canvas/decorators/event-decorator.ts:29

Is a decorator that register a event in the game. Is a required decorator for use the event in the game. Thanks to this decoration the game has the possibility of updating the events to the latest modification and saving the game.

Parameters

name?

string

is th identifier of the event, by default is the name of the class

Returns

(_target, propertyKey, descriptor) => void

Example

export class Events {
    \@eventDecorator()
    static eventExample(event: FederatedEvent, component: Sprite) {
        // event code here
    }
}

sprite.on("pointerdown", Events.eventExample);