mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-04-18 08:21:03 +00:00
24 lines
530 B
JavaScript
24 lines
530 B
JavaScript
import { Settings, UpdateSettings } from '$wails/go/app/App.js';
|
|
import { writable } from 'svelte/store';
|
|
|
|
const { set, subscribe } = writable({});
|
|
let skipUpdate = true;
|
|
|
|
async function reload() {
|
|
const newSettings = await Settings();
|
|
set(newSettings);
|
|
return newSettings;
|
|
}
|
|
|
|
reload();
|
|
subscribe(newSettings => {
|
|
if (skipUpdate) {
|
|
skipUpdate = false;
|
|
return;
|
|
}
|
|
UpdateSettings(JSON.stringify(newSettings || {}));
|
|
});
|
|
|
|
const applicationSettings = { reload, set, subscribe };
|
|
export default applicationSettings;
|