Fixed the TickerWidget making repeated calls
This commit is contained in:
parent
6e3da89ab7
commit
8f02ab2bef
|
@ -172,6 +172,13 @@
|
|||
var errCount = [];
|
||||
var interval;
|
||||
var loadWidgets = function () {
|
||||
// Clear exisitng interval to stop multiple attempts to load at the same time.
|
||||
if (interval != null)
|
||||
{
|
||||
clearInterval(interval);
|
||||
}
|
||||
|
||||
// Load widgets
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
$("#ticker-widgets").load('@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)_get/TickerWidgets', '', function (responseText, textStatus, XMLHttpRequest) {
|
||||
if (textStatus == 'error') {
|
||||
|
@ -184,13 +191,15 @@
|
|||
} else {
|
||||
errCount["TickerWidgets"] = 0;
|
||||
}
|
||||
|
||||
// Reinstate the interval.
|
||||
interval = setInterval(function () { loadWidgets(); }, 5000);
|
||||
});
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
errCount["TickerWidgets"] = 0;
|
||||
loadWidgets();
|
||||
interval = setInterval(function () { loadWidgets(); }, 5 * 1000);
|
||||
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
$('.text-autocolor').autocolor(false);
|
||||
|
|
Loading…
Reference in New Issue