类 BedrockEventSubscriptionCache实验性

A cache for bedrock event subscriptions. Stores off a subscription by event key, and upon teardown unregisters all subscriptions.

构造函数

方法

  • 实验性

    类型参数

    参数

    • event: T

      The event on the bedrock APIs to which to subscribe

    • 动态参数...params: Parameters<WorldAfterEvents[T]["subscribe"]>

      The parameters to the subscription method for the event. Auto complete will display this for you

    返回 ReturnType<WorldAfterEvents[T]["subscribe"]>

    Subcribes to a bedrock event using the key of the desired event. When subscribed, the event handler is both returned, but also cached internally for unsubscription. This means the caller of the subscription does not need to worry about unsubscription since the cache will automatically unsubscribe handlers on overall teardown.