Slightly modify setTimeouts so they don't stack up in some browsers.
This commit is contained in:
parent
13bd765232
commit
7986b34033
|
@ -163,7 +163,6 @@ export default {
|
|||
},
|
||||
notificationsLoading: true,
|
||||
notifications: [],
|
||||
stationsTimeout: null,
|
||||
stationsFields: [
|
||||
{
|
||||
key: 'station',
|
||||
|
@ -220,7 +219,7 @@ export default {
|
|||
console.error(error);
|
||||
});
|
||||
|
||||
this.stationsTimeout = setTimeout(this.updateNowPlaying, 30000);
|
||||
setTimeout(this.updateNowPlaying, 30000);
|
||||
},
|
||||
methods: {
|
||||
toggleCharts () {
|
||||
|
@ -235,7 +234,7 @@ export default {
|
|||
},
|
||||
updateNowPlaying () {
|
||||
this.$refs.datatable.refresh();
|
||||
this.stationsTimeout = setTimeout(this.updateNowPlaying, 30000);
|
||||
setTimeout(this.updateNowPlaying, 30000);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -272,7 +272,6 @@ export default {
|
|||
'name': '',
|
||||
'url': ''
|
||||
},
|
||||
'np_timeout': null,
|
||||
'nchan_subscriber': null,
|
||||
'clock_interval': null
|
||||
};
|
||||
|
@ -283,8 +282,7 @@ export default {
|
|||
|
||||
// Convert initial NP data from prop to data.
|
||||
this.setNowPlaying(this.np);
|
||||
|
||||
this.np_timeout = setTimeout(this.checkNowPlaying, 5000);
|
||||
setTimeout(this.checkNowPlaying, 5000);
|
||||
},
|
||||
computed: {
|
||||
lang_play_btn () {
|
||||
|
@ -399,11 +397,12 @@ export default {
|
|||
} else {
|
||||
axios.get(this.nowPlayingUri).then((response) => {
|
||||
this.setNowPlaying(response.data);
|
||||
|
||||
setTimeout(this.checkNowPlaying, 15000);
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
}).then(() => {
|
||||
clearTimeout(this.np_timeout);
|
||||
this.np_timeout = setTimeout(this.checkNowPlaying, 15000);
|
||||
|
||||
setTimeout(this.checkNowPlaying, 30000);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -118,8 +118,7 @@ export default {
|
|||
playlist: ''
|
||||
},
|
||||
schedule: []
|
||||
},
|
||||
npTimeout: null
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
|
@ -163,15 +162,12 @@ export default {
|
|||
axios.get(this.profileApiUri).then((response) => {
|
||||
let np = response.data;
|
||||
np.loading = false;
|
||||
|
||||
this.np = np;
|
||||
|
||||
setTimeout(this.checkNowPlaying, 15000);
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
clearTimeout(this.np_timeout);
|
||||
this.npTimeout = setTimeout(this.checkNowPlaying, 30000);
|
||||
}).then(() => {
|
||||
clearTimeout(this.np_timeout);
|
||||
this.npTimeout = setTimeout(this.checkNowPlaying, 15000);
|
||||
setTimeout(this.checkNowPlaying, 30000);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue