Skip to content

Commit

Permalink
delay comment
Browse files Browse the repository at this point in the history
  • Loading branch information
solderq35 committed Apr 14, 2024
1 parent 48bbc4b commit ad6dd97
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export default {
// https://stackoverflow.com/a/75952012
// https://stackoverflow.com/questions/58652880/what-is-the-replacement-for-performance-navigation-type-in-angular
this.backButtonRefresh()
if (process.env.NODE_ENV === 'production') {
this.timer = window.setInterval(
if (process.env.NODE_ENV === 'development') {
this.timer = setInterval(
this.fetchLastModified,
this.refreshInterval * 1000
) // setInterval expects milliseconds
Expand All @@ -39,7 +39,7 @@ export default {
url: process.env.VUE_APP_HOST_ADDRESS,
modifiedDateUnix: 0,
timeDiffUnix: 0,
refreshInterval: 30 // time in seconds
refreshInterval: 20 // time in seconds. TODO: Increase this to like 10 minutes before merge
}
},
methods: {
Expand Down Expand Up @@ -75,6 +75,7 @@ export default {
this.timeDiffUnix =
Math.floor(Date.now() / 1000) - this.modifiedDateUnix
// TODO: remove log statements before merge
console.log(modifiedDateString)
console.log(this.timeDiffUnix)
})
Expand All @@ -91,8 +92,12 @@ export default {
// if the modifiedDateUnix changes (not counting initial load), the page is reloaded
// https://v2.vuejs.org/v2/guide/computed.html#Watchers
modifiedDateUnix: function (newDate, oldDate) {
console.log(oldDate)
if (oldDate !== 0) {
window.location.reload()
console.log('page reloading in 10 seconds')
setTimeout(() => {
window.location.reload()
}, 10000)
}
}
}
Expand Down

0 comments on commit ad6dd97

Please sign in to comment.