Last active
July 8, 2025 06:28
-
-
Save guillaumefalvet/f9643d6479530493266aab056873d725 to your computer and use it in GitHub Desktop.
HMI_TS_SNIPPETS.ts
This file contains hidden or 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
| { | |
| // Place your snippets for typescript here. Each snippet is defined under a snippet name and has a prefix, body and | |
| // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
| // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
| // same ids are connected. | |
| // Example: | |
| // "Print to console": { | |
| // "prefix": "log", | |
| // "body": [ | |
| // "console.log('$1');", | |
| // "$2" | |
| // ], | |
| // "description": "Log output to console" | |
| // } | |
| "life cycle declaration": { | |
| "prefix": "lc", | |
| "body": [ | |
| "// -- LIFECYCLE -- //" | |
| ], | |
| "description": "Lifecycle declaration" | |
| }, | |
| "public declaration": { | |
| "prefix": "pub", | |
| "body": [ | |
| "// -- PUBLIC -- //" | |
| ], | |
| "description": "Public declaration" | |
| }, | |
| "private declaration": { | |
| "prefix": "priv", | |
| "body": [ | |
| "// -- PRIVATE -- //" | |
| ], | |
| "description": "Private declaration" | |
| }, | |
| "init subject": { | |
| "prefix": "initsubj", | |
| "body": [ | |
| "/**", | |
| " * @description Initialize the subjects.", | |
| " * @returns { void } void", | |
| " */", | |
| "private _initSubjects(): void {", | |
| "\t$0", | |
| "}" | |
| ], | |
| "description": "Initialize a Subject" | |
| }, | |
| "init ws": { | |
| "prefix": "initws", | |
| "body": [ | |
| "/**", | |
| " * @description Initialize websocket connections.", | |
| " * @returns { void } void", | |
| " */", | |
| "private _initWs(): void {", | |
| "\t$0", | |
| "}" | |
| ], | |
| "description": "Initialize a Web connection", | |
| }, | |
| "init http": { | |
| "prefix": "inithttp", | |
| "body": [ | |
| "/**", | |
| " * @description Initialize http connections.", | |
| " * @returns { void } void", | |
| " */", | |
| "private _initHttp(): void {", | |
| "\t$0", | |
| "}" | |
| ], | |
| "description": "Initialize an HTTP connection", | |
| }, | |
| "init ts": { | |
| "prefix": "initts", | |
| "body": [ | |
| "/**", | |
| " * @description Initialize the transfer state.", | |
| " * @returns { void } void", | |
| " */", | |
| "private _initTS(): void {", | |
| "\t$0", | |
| "}" | |
| ], | |
| "description": "Initialize the transfer state", | |
| }, | |
| "init sub": { | |
| "prefix": "initsubs", | |
| "body": [ | |
| "/**", | |
| " * @description Initialize the subscriptions.", | |
| " * @returns { void } void", | |
| " */", | |
| "private _initSubscriptions(): void {", | |
| "\t$0", | |
| "}" | |
| ], | |
| "description": "Initialize the subscriptions", | |
| }, | |
| "sd-action": { | |
| "prefix": "sda", | |
| "body": [ | |
| "@action({ UUID: undefined })", | |
| "export class $1Action extends SingletonAction<$1Settings> {", | |
| "\t// Main Loop trigger", | |
| "\tprivate _notifyMainLoop: Subject<void> = new Subject();", | |
| "\tprivate _triggerMainLoop(): void {", | |
| "\t\tthis._notifyMainLoop.next();", | |
| "\t}", | |
| "", | |
| "\t// Subscription Manager", | |
| "\tprivate _subscriptionManager = new SubscriptionRecordManager();", | |
| "", | |
| "\tconstructor() {", | |
| "\t\tsuper();", | |
| "\t}", | |
| "\t", | |
| "\tasync onWillAppear(ev: WillAppearEvent<$1Settings>): Promise<void> {}", | |
| "", | |
| "\tonKeyDown(ev: KeyDownEvent<$1Settings>): void {}", | |
| "", | |
| "\tonWillDisappear(ev: WillDisappearEvent<$1Settings>): void {", | |
| "\t\tthis._subscriptionManager.getSubscription(ev.action.id)?.unsubscribe();", | |
| "\t\tthis._subscriptionManager.deleteSubscription(ev.action.id);", | |
| "\t}", | |
| "", | |
| "\tasync onSendToPlugin(ev: SendToPluginEvent<$1Settings, $1Settings>): Promise<void> {", | |
| "\t\tthis._triggerMainLoop();", | |
| "\t}", | |
| "}", | |
| ], | |
| "description": "Stream Deck action singleton" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment