fixed build window issue:

This commit is contained in:
Jade (Rose) Rowland 2024-06-14 15:28:24 -04:00
parent 2a2ddf205a
commit 1d95da7a3a
3 changed files with 8 additions and 4 deletions

View file

@ -29,9 +29,13 @@ export const defaultSettings = {
userPatterns: '{}',
audioDeviceName: defaultAudioDeviceName,
};
const search = new URLSearchParams(window.location.search);
let search = null;
if (typeof window !== 'undefined') {
search = new URLSearchParams(window.location.search);
}
// if running multiple instance in one window, it will use the settings for that instance. else default to normal
const instance = parseInt(search.get('instance') ?? '0');
const instance = parseInt(search?.get('instance') ?? '0');
const settings_key = `strudel-settings${instance > 0 ? instance : ''}`;
export const settingsMap = persistentMap(settings_key, defaultSettings);