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

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

View File

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