mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-11 17:16:59 -05:00
only auto sync when window is focused
This commit is contained in:
@@ -575,10 +575,20 @@ export default {
|
||||
useUserPreferenceStore().loadUserSettings()
|
||||
useUserPreferenceStore().loadDeviceSettings()
|
||||
this.setupAutoSync()
|
||||
this.setupFocusMonitor()
|
||||
|
||||
},
|
||||
methods: {
|
||||
useUserPreferenceStore,
|
||||
useShoppingListStore,
|
||||
|
||||
setupFocusMonitor: function () {
|
||||
setInterval(() => {
|
||||
useShoppingListStore().autosync_has_focus = document.hasFocus()
|
||||
}, 1000);
|
||||
|
||||
},
|
||||
|
||||
setupAutoSync: function () {
|
||||
// prevent setting up multiple loops on accident
|
||||
// TODO should this just raise an error?
|
||||
|
||||
Reference in New Issue
Block a user