@elgato/streamdeck
Version:
The official Node.js SDK for creating Stream Deck plugins.
36 lines (35 loc) • 2.12 kB
TypeScript
import type { IDisposable } from "../common/disposable";
import type { JsonObject } from "../common/json";
import { 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>;
/**
* Occurs when the global settings are requested using {@link getGlobalSettings}, or when the the global settings were updated by the property inspector.
* @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 using {@link Action.getSettings}, or when the the settings were updated by the property inspector.
* @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>;