UNPKG

@elgato/streamdeck

Version:

The official Node.js SDK for creating Stream Deck plugins.

51 lines (50 loc) 2.71 kB
import type { IDisposable, JsonObject, JsonValue } from "@elgato/utils"; import type { DialAction, KeyAction } from "./actions/index.js"; import { type PropertyInspectorDidAppearEvent, type PropertyInspectorDidDisappearEvent, SendToPluginEvent } from "./events/index.js"; /** * Controller capable of sending/receiving payloads with the property inspector, and listening for events. */ declare class UIController { #private; /** * Initializes a new instance of the {@link UIController} class. */ constructor(); /** * Gets the action associated with the current property. * @returns The action; otherwise `undefined` when a property inspector is not visible. */ get action(): DialAction | KeyAction | undefined; /** * Occurs when the property inspector associated with the action becomes visible, i.e. the user * selected an action in the Stream Deck application.. * @template T The type of settings associated with the action. * @param listener Function to be invoked when the event occurs. * @returns A disposable that, when disposed, removes the listener. */ onDidAppear<T extends JsonObject = JsonObject>(listener: (ev: PropertyInspectorDidAppearEvent<T>) => void): IDisposable; /** * Occurs when the property inspector associated with the action disappears, i.e. the user unselected * the action in the Stream Deck application. * @template T The type of settings associated with the action. * @param listener Function to be invoked when the event occurs. * @returns A disposable that, when disposed, removes the listener. */ onDidDisappear<T extends JsonObject = JsonObject>(listener: (ev: PropertyInspectorDidDisappearEvent<T>) => void): IDisposable; /** * Occurs when a message was sent to the plugin _from_ the property inspector. * @template TPayload The type of the payload received from the property inspector. * @template TSettings The type of settings associated with the action. * @param listener Function to be invoked when the event occurs. * @returns A disposable that, when disposed, removes the listener. */ onSendToPlugin<TPayload extends JsonValue = JsonValue, TSettings extends JsonObject = JsonObject>(listener: (ev: SendToPluginEvent<TPayload, TSettings>) => void): IDisposable; /** * Sends the payload to the property inspector; the payload is only sent when the property inspector * is visible for an action provided by this plugin. * @param payload Payload to send. */ sendToPropertyInspector(payload: JsonValue): Promise<void>; } export declare const ui: UIController; export { type UIController };