Skip to content

Commit

Permalink
feat: more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
harshkhandeparkar committed Jul 25, 2021
1 parent e6afc06 commit 5670f35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ const settingsManager = new SettingsManager<Schema>(
}
)

// any key other than 'theme' and 'startFullscreen' will be invalid.
// theme key will only accept 'dark' or 'light' as a value due to the generic.
settingsManager.setCache('theme', 'dark');
// checks whether the settings file exists and created it if not
// loads the settings if it exists
settingsManager.initialize().then(() => {
// any key other than 'theme' and 'startFullscreen' will be invalid.
// theme key will only accept 'dark' or 'light' as a value due to the generic.
settingsManager.setCache('theme', 'dark');
}

// at a later time
await settingsManager.syncCache();
Expand Down
2 changes: 1 addition & 1 deletion src/settings-manager/settings-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class SettingsManager<SettingsSchema extends {} = any> {
* Initializes a settings file with the defaults. If settings exist, load them.
* @returns The entire settings object
*/
async initialize() {
async initialize(): Promise<SettingsSchema> {
const currentSettings = await getSettings<SettingsSchema>();
this.path = currentSettings.path;

Expand Down

0 comments on commit 5670f35

Please sign in to comment.