# Subscribe

`function` in `core` · v0.7.0

<https://docs.seedcord.org/packages/core/0.7.0/subscribe>

Registers a subscriber handler class with a specific subscriber event.

Associates the decorated class with a subscriber event type for automatic registration and execution when the subscriber is emitted.

```ts
Subscribe<TSubscriber>(
    subscriber: TSubscriber,
    options?: SubscribeOptions
): <
    HandlerCtor extends Constructor<
        Subscriber<TSubscriber, CoreBase>
    >
>(
    constructor: HandlerCtor
) => void
```

Registers a subscriber handler class with a specific subscriber event.

Associates the decorated class with a subscriber event type for automatic registration and execution when the subscriber is emitted.

Parameters.

- `subscriber` `TSubscriber` — The subscriber event name to register for
- `options?` `SubscribeOptions` — Options to configure the subscriber handler registration.

Returns `<HandlerCtor extends Constructor<Subscriber<TSubscriber, CoreBase>>>(constructor: HandlerCtor) => void`.
