diff options
Diffstat (limited to 'src/view/options.ts')
-rw-r--r-- | src/view/options.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/view/options.ts b/src/view/options.ts new file mode 100644 index 0000000..4c71be2 --- /dev/null +++ b/src/view/options.ts @@ -0,0 +1,24 @@ +export type Options = { + major: boolean, + minor: boolean, + bpm: number, + beatsPerChord: number +} + +let defaultOptions: Options = { + major: true, + minor: false, + bpm: 90, + beatsPerChord: 4 +} + +let key: string = 'options' + +export function load(): Options { + let str = localStorage[key] + return str && JSON.parse(str) || defaultOptions +} + +export function save(options: Options): void { + localStorage[key] = JSON.stringify(options) +} |