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) }