# Function: eventDecorator() (/jsdoc/pixi-vn/index/functions/eventDecorator)



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

Defined in: [src/canvas/decorators/event-decorator.ts:29](https://github.com/DRincs-Productions/pixi-vn/blob/4b8909bd13b1cc1fa7efb0238c44a5af3767e61f/src/canvas/decorators/event-decorator.ts#L29)

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 [#parameters]

### name? [#name]

`string`

The id used by Pixi’VN to refer to this function (must be unique). If you don't pass the id, the function name will be used as the id.

## Returns [#returns]

(`_target`, `propertyKey`, `descriptor`) => `void`

## Example [#example]

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

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