-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use app monitoring instead of polling to establish websocket connection
Fixes #79
- Loading branch information
Showing
6 changed files
with
35 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
import actionManager from "@managers/action"; | ||
import vAtisManager from "@managers/vatis"; | ||
import mainLogger from "@utils/logger"; | ||
|
||
const logger = mainLogger.child({ service: "handleActionAdded" }); | ||
|
||
export const handleActionAdded = () => { | ||
// If this is the first button added then connect to vATIS. That will | ||
// also cause a dump of the current state of all stations in vATIS. | ||
if (actionManager.getActions().length === 1 && !vAtisManager.isConnected) { | ||
vAtisManager.connect(); | ||
} | ||
logger.info("Action added"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import vAtisManager from "@managers/vatis"; | ||
import svgManager from "@managers/svg"; | ||
|
||
export const handleActionRemoved = (count: number) => { | ||
if (count === 0) { | ||
vAtisManager.disconnect(); | ||
svgManager.reset(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ApplicationDidLaunchEvent } from "@elgato/streamdeck"; | ||
import mainLogger from "@utils/logger"; | ||
import vAtisManager from "@managers/vatis"; | ||
|
||
const logger = mainLogger.child({ service: "plugin" }); | ||
|
||
export const handleOnApplicationDidLaunch = (ev: ApplicationDidLaunchEvent) => { | ||
logger.info("Received applicationDidLaunch event", ev.application); | ||
vAtisManager.connect(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ApplicationDidTerminateEvent } from "@elgato/streamdeck"; | ||
import mainLogger from "@utils/logger"; | ||
import vAtisManager from "@managers/vatis"; | ||
|
||
const logger = mainLogger.child({ service: "plugin" }); | ||
|
||
export const handleOnApplicationDidTerminate = ( | ||
ev: ApplicationDidTerminateEvent | ||
) => { | ||
logger.info("Received applicationDidTerminate event", ev.application); | ||
vAtisManager.disconnect(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters