@elgato/streamdeck
Version:
The official Node.js SDK for creating Stream Deck plugins.
62 lines (61 loc) • 2.68 kB
TypeScript
import { type JsonObject } from "@elgato/utils";
import type { Resources } from "../../api/index.js";
import { ActionContext } from "./context.js";
import type { DialAction } from "./dial.js";
import type { KeyAction } from "./key.js";
/**
* 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 {
#private;
/**
* Gets the resources (files) associated with this action; these resources are embedded into the
* action when it is exported, either individually, or as part of a profile.
*
* Available from Stream Deck 7.1.
* @returns The resources.
*/
getResources(): Promise<Resources>;
/**
* Gets the settings associated this action instance.
* @template U The type of settings associated with the action.D
* @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<T>;
/**
* Determines whether this instance is a key.
* @returns `true` when this instance is a key; otherwise `false`.
*/
isKey(): this is KeyAction<T>;
/**
* Sets the resources (files) associated with this action; these resources are embedded into the
* action when it is exported, either individually, or as part of a profile.
*
* Available from Stream Deck 7.1.
* @example
* action.setResources({
* fileOne: "c:\\hello-world.txt",
* anotherFile: "c:\\icon.png"
* });
* @param resources The resources as a map of file paths.
* @returns `Promise` resolved when the resources are saved to Stream Deck.
*/
setResources(resources: Resources): Promise<void>;
/**
* Sets the settings associated with this action instance. Use in conjunction with {@link Action.getSettings}.
* @param value Settings to persist.
* @returns `Promise` resolved when the settings are sent to Stream Deck.
*/
setSettings<U extends JsonObject = T>(value: 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>;
}