From 57809e46fff4f4e2d80a40bb6049a49a122a3640 Mon Sep 17 00:00:00 2001 From: Sanjula Ganepola Date: Thu, 26 Sep 2024 20:33:11 -0400 Subject: [PATCH] Add storage manager Signed-off-by: Sanjula Ganepola --- src/storageManager.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/storageManager.ts diff --git a/src/storageManager.ts b/src/storageManager.ts new file mode 100644 index 0000000..8ff33ab --- /dev/null +++ b/src/storageManager.ts @@ -0,0 +1,22 @@ +import { ExtensionContext } from "vscode"; + +export class StorageManager { + private context: ExtensionContext; + private storageKey: string = 'githubLocalActions'; + + constructor(context: ExtensionContext) { + this.context = context; + } + + keys(): readonly string[] { + return this.context.globalState.keys(); + } + + get(key: string): T | undefined { + return this.context.globalState.get(`${this.storageKey}.${key}`); + } + + async update(key: string, value: any): Promise { + await this.context.globalState.update(`${this.storageKey}.${key}`, value); + } +} \ No newline at end of file