UNPKG

@elgato/streamdeck

Version:

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

48 lines (47 loc) 2.6 kB
import type { IDisposable } from "../common/disposable"; import type { JsonObject } from "../common/json"; import type { DidReceiveGlobalSettingsEvent, DidReceiveSettingsEvent } from "./events"; /** * Gets the global settings associated with the plugin. Use in conjunction with {@link setGlobalSettings}. * @template T The type of global settings associated with the plugin. * @returns Promise containing the plugin's global settings. */ export declare function getGlobalSettings<T extends JsonObject = JsonObject>(): Promise<T>; /** * Gets the settings for the action associated with the UI. * @template T The type of settings associated with the action. * @returns Promise containing the action instance's settings. */ export declare function getSettings<T extends JsonObject = JsonObject>(): Promise<T>; /** * Occurs when the global settings are requested, or when the the global settings were updated by the plugin. * @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. */ export declare function onDidReceiveGlobalSettings<T extends JsonObject = JsonObject>(listener: (ev: DidReceiveGlobalSettingsEvent<T>) => void): IDisposable; /** * Occurs when the settings associated with an action instance are requested, or when the the settings were updated by the plugin. * @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. */ export declare function onDidReceiveSettings<T extends JsonObject = JsonObject>(listener: (ev: DidReceiveSettingsEvent<T>) => void): IDisposable; /** * Sets the global {@link settings} associated the plugin. **Note**, these settings are only available to this plugin, and should be used to persist information securely. Use in * conjunction with {@link getGlobalSettings}. * @param settings Settings to save. * @returns `Promise` resolved when the global `settings` are sent to Stream Deck. * @example * streamDeck.settings.setGlobalSettings({ * apiKey, * connectedDate: new Date() * }) */ export declare function setGlobalSettings<T extends JsonObject>(settings: T): Promise<void>; /** * Sets the settings for the action associated with the UI. * @param settings Settings to persist. * @returns `Promise` resolved when the {@link settings} are sent to Stream Deck. */ export declare function setSettings<T extends JsonObject>(settings: T): Promise<void>;