退出设置界面时检查配置是否改动并提示用户保存配置

This commit is contained in:
linyuchen 2024-10-23 17:10:33 +08:00
parent 2a67ffae24
commit 8b04833a6a

@ -456,9 +456,11 @@ async function onSettingWindowCreated(view: Element) {
} }
window.llonebot.checkVersion().then(checkVersionFunc) window.llonebot.checkVersion().then(checkVersionFunc)
window.addEventListener('beforeunload', () => { window.addEventListener('beforeunload', () => {
if (JSON.stringify(ob11Config) === JSON.stringify(config.ob11)) return window.llonebot.getConfig().then(oldConfig=>{
config.ob11 = ob11Config if(JSON.stringify(oldConfig) !== JSON.stringify(config)){
window.llonebot.setConfig(true, config) window.llonebot.setConfig(true, config)
}
})
}) })
} }