@companion-module/base
    Preparing search index...

    Type Alias CompanionActionDefinitionSubscribeHooks<TOptions>

    Variant where at least subscribe is present, while optionsToMonitorForSubscribe becomes required and skipUnsubscribeOnOptionsChange remains optional.

    type CompanionActionDefinitionSubscribeHooks<
        TOptions extends CompanionOptionValues = CompanionOptionValues,
    > = {
        optionsToMonitorForSubscribe: StringKeys<TOptions>[];
        skipUnsubscribeOnOptionsChange?: boolean;
        subscribe: (
            action: CompanionActionInfo<TOptions>,
            context: CompanionActionContext,
        ) => Promise<void> | void;
        unsubscribe?: (
            action: CompanionActionInfo<TOptions>,
            context: CompanionActionContext,
        ) => Promise<void> | void;
    }

    Type Parameters

    Index

    Properties

    optionsToMonitorForSubscribe: StringKeys<TOptions>[]

    Only monitor the specified options for re-running the subscribe/unsubscribe callbacks It is recommended to set this for all actions using subscribe, to reduce unnecessary calls when the user has the values driven by expressions. If not set, all options changes will trigger unsubscribe/subscribe

    skipUnsubscribeOnOptionsChange?: boolean

    If true, the unsubscribe callback will not be called when the options change, only when the action is removed or disabled

    subscribe: (
        action: CompanionActionInfo<TOptions>,
        context: CompanionActionContext,
    ) => Promise<void> | void

    Called to report the existence of an action Useful to ensure necessary data is loaded

    unsubscribe?: (
        action: CompanionActionInfo<TOptions>,
        context: CompanionActionContext,
    ) => Promise<void> | void

    Called to report an action has been edited/removed Useful to cleanup subscriptions setup in subscribe