@elgato/streamdeck
Version:
The official Node.js SDK for creating Stream Deck plugins.
99 lines (98 loc) • 5.45 kB
TypeScript
import type { IDisposable } from "../../common/disposable";
import type { JsonObject } from "../../common/json";
import { DialDownEvent, DialRotateEvent, DialUpEvent, KeyDownEvent, KeyUpEvent, TitleParametersDidChangeEvent, TouchTapEvent, WillAppearEvent, WillDisappearEvent } from "../events";
import type { SingletonAction } from "./singleton-action";
import { ReadOnlyActionStore } from "./store";
/**
* Provides functions, and information, for interacting with Stream Deck actions.
*/
declare class ActionService extends ReadOnlyActionStore {
/**
* Initializes a new instance of the {@link ActionService} class.
*/
constructor();
/**
* Occurs when the user presses a dial (Stream Deck +).
* @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.
*/
onDialDown<T extends JsonObject = JsonObject>(listener: (ev: DialDownEvent<T>) => void): IDisposable;
/**
* Occurs when the user rotates a dial (Stream Deck +).
* @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.
*/
onDialRotate<T extends JsonObject = JsonObject>(listener: (ev: DialRotateEvent<T>) => void): IDisposable;
/**
* Occurs when the user releases a pressed dial (Stream Deck +).
* @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.
*/
onDialUp<T extends JsonObject = JsonObject>(listener: (ev: DialUpEvent<T>) => void): IDisposable;
/**
* Occurs when the user presses a action down.
* @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.
*/
onKeyDown<T extends JsonObject = JsonObject>(listener: (ev: KeyDownEvent<T>) => void): IDisposable;
/**
* Occurs when the user releases a pressed action.
* @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.
*/
onKeyUp<T extends JsonObject = JsonObject>(listener: (ev: KeyUpEvent<T>) => void): IDisposable;
/**
* Occurs when the user updates an action's title settings in the Stream Deck application. See also {@link Action.setTitle}.
* @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.
*/
onTitleParametersDidChange<T extends JsonObject = JsonObject>(listener: (ev: TitleParametersDidChangeEvent<T>) => void): IDisposable;
/**
* Occurs when the user taps the touchscreen (Stream Deck +).
* @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.
*/
onTouchTap<T extends JsonObject = JsonObject>(listener: (ev: TouchTapEvent<T>) => void): IDisposable;
/**
* Occurs when an action appears on the Stream Deck due to the user navigating to another page, profile, folder, etc. This also occurs during startup if the action is on the "front
* page". An action refers to _all_ types of actions, e.g. keys, dials,
* @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.
*/
onWillAppear<T extends JsonObject = JsonObject>(listener: (ev: WillAppearEvent<T>) => void): IDisposable;
/**
* Occurs when an action disappears from the Stream Deck due to the user navigating to another page, profile, folder, etc. An action refers to _all_ types of actions, e.g. keys,
* dials, touchscreens, pedals, etc.
* @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.
*/
onWillDisappear<T extends JsonObject = JsonObject>(listener: (ev: WillDisappearEvent<T>) => void): IDisposable;
/**
* Registers the action with the Stream Deck, routing all events associated with the {@link SingletonAction.manifestId} to the specified {@link action}.
* @param action The action to register.
* @example
* @action({ UUID: "com.elgato.test.action" })
* class MyCustomAction extends SingletonAction {
* export function onKeyDown(ev: KeyDownEvent) {
* // Do some awesome thing.
* }
* }
*
* streamDeck.actions.registerAction(new MyCustomAction());
*/
registerAction<TAction extends SingletonAction<TSettings>, TSettings extends JsonObject = JsonObject>(action: TAction): void;
}
/**
* Service for interacting with Stream Deck actions.
*/
export declare const actionService: ActionService;
export { type ActionService };