Last active
January 11, 2022 19:27
-
-
Save chrishasz/d39ee076a863165d1696581a0eccb97a to your computer and use it in GitHub Desktop.
A type-generic class to read and write project or extension-wide data in VSCode's durable key-value storage
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
| 'use strict'; | |
| import { Memento } from "vscode"; | |
| export class LocalStorageService { | |
| constructor(private storage: Memento) { } | |
| public getValue<T>(key : string) : T{ | |
| return this.storage.get<T>(key, null); | |
| } | |
| public setValue<T>(key : string, value : T){ | |
| this.storage.update(key, value ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
null change to ""