Skip to content

How can multi-action buttons propagate state? #143

Answered by ChekTek
buffos asked this question in Help
Discussion options

You must be logged in to vote

Yup, you can import and utilize the streamDeck singleton anywhere throughout your plugin. Here is a quick snippet from our Twitch plugin that demonstrates using the logger from streamDeck within the keyUp of an action.

import streamDeck from "@elgato/streamdeck";

...

/**
 * Clears the chat of the specified Twitch channel.
 */
override async onKeyUp({ action, payload }: KeyUpEvent<ClearChatSettings>): Promise<void> {
	try {
		const { settings } = payload;
		const { accountId } = settings;

		await twitchService.clearChat(accountId);

		action.showOk();
	} catch (e) {
		action.showAlert();
		streamDeck.logger.error("Failed to clear chat", e);
	}
}

...

One thing worth noting, is that getG…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@buffos
Comment options

@ChekTek
Comment options

Answer selected by buffos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants