Skip to content

Commit

Permalink
fix postmaster lag
Browse files Browse the repository at this point in the history
  • Loading branch information
fcannizzaro committed Jan 27, 2024
1 parent 244ee6e commit e448fff
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions plugin/src/actions/postmaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ import {
import { State } from "@/state";
import { log } from "@/util/logger";
import { Watcher } from "@/util/watcher";
import { Action, action, SingletonAction } from "@elgato/streamdeck";
import { Schemas } from "@plugin/types";
import {
Action,
action,
DidReceiveSettingsEvent,
SingletonAction,
} from "@elgato/streamdeck";
import { PostmasterSettings, Schemas } from "@plugin/types";

/**
* Show postmaster contents.
Expand All @@ -18,8 +23,9 @@ import { Schemas } from "@plugin/types";
export class Postmaster extends SingletonAction {
private watcher = Watcher("state");

private async update(e: Action) {
const { type, style } = Schemas.postmaster(await e.getSettings());
private async update(e: Action, settings?: PostmasterSettings) {
const { type, style } =
settings ?? Schemas.postmaster(await e.getSettings());
const postmaster = State.get("postmaster");
const current = postmaster?.[type] ?? "?";
const value =
Expand All @@ -35,8 +41,8 @@ export class Postmaster extends SingletonAction {
e.setState(state);
}

onDidReceiveSettings(e: DidReceiveSettings) {
this.update(e.action);
onDidReceiveSettings(e: DidReceiveSettingsEvent<PostmasterSettings>) {
this.update(e.action, e.payload.settings);
}

onWillAppear(e: WillAppear) {
Expand Down

0 comments on commit e448fff

Please sign in to comment.