@elgato/streamdeck
Version:
The official Node.js SDK for creating Stream Deck plugins.
38 lines (37 loc) • 1.74 kB
TypeScript
import type { JsonObject } from "../../common/json";
import { ActionContext } from "./context";
import type { DialAction } from "./dial";
import type { KeyAction } from "./key";
/**
* Provides a contextualized instance of an {@link Action}, allowing for direct communication with the Stream Deck.
* @template T The type of settings associated with the action.
*/
export declare class Action<T extends JsonObject = JsonObject> extends ActionContext {
/**
* Gets the settings associated this action instance.
* @template U The type of settings associated with the action.
* @returns Promise containing the action instance's settings.
*/
getSettings<U extends JsonObject = T>(): Promise<U>;
/**
* Determines whether this instance is a dial.
* @returns `true` when this instance is a dial; otherwise `false`.
*/
isDial(): this is DialAction;
/**
* Determines whether this instance is a key.
* @returns `true` when this instance is a key; otherwise `false`.
*/
isKey(): this is KeyAction;
/**
* Sets the {@link settings} associated with this action instance. Use in conjunction with {@link Action.getSettings}.
* @param settings Settings to persist.
* @returns `Promise` resolved when the {@link settings} are sent to Stream Deck.
*/
setSettings<U extends JsonObject = T>(settings: U): Promise<void>;
/**
* Temporarily shows an alert (i.e. warning), in the form of an exclamation mark in a yellow triangle, on this action instance. Used to provide visual feedback when an action failed.
* @returns `Promise` resolved when the request to show an alert has been sent to Stream Deck.
*/
showAlert(): Promise<void>;
}