mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-18 00:56:38 +00:00
Added native classList to backgroundPoll
This commit is contained in:
parent
7c48586394
commit
9457304ad3
@ -119,27 +119,28 @@ function restoreUiAfterNaClLoad() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function beginBackgroundPollingOfHost(host) {
|
function beginBackgroundPollingOfHost(host) {
|
||||||
|
var el = document.querySelector('#hostgrid-' + host.serverUid)
|
||||||
if (host.online) {
|
if (host.online) {
|
||||||
$("#hostgrid-" + host.serverUid).removeClass('host-cell-inactive');
|
el.classList.remove('host-cell-inactive')
|
||||||
// The host was already online. Just start polling in the background now.
|
// The host was already online. Just start polling in the background now.
|
||||||
activePolls[host.serverUid] = window.setInterval(function() {
|
activePolls[host.serverUid] = window.setInterval(function() {
|
||||||
// every 5 seconds, poll at the address we know it was live at
|
// every 5 seconds, poll at the address we know it was live at
|
||||||
host.pollServer(function() {
|
host.pollServer(function() {
|
||||||
if (host.online) {
|
if (host.online) {
|
||||||
$("#hostgrid-" + host.serverUid).removeClass('host-cell-inactive');
|
el.classList.remove('host-cell-inactive')
|
||||||
} else {
|
} else {
|
||||||
$("#hostgrid-" + host.serverUid).addClass('host-cell-inactive');
|
el.classList.add('host-cell-inactive')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 5000);
|
}, 5000);
|
||||||
} else {
|
} else {
|
||||||
$("#hostgrid-" + host.serverUid).addClass('host-cell-inactive');
|
el.classList.add('host-cell-inactive')
|
||||||
// The host was offline, so poll immediately.
|
// The host was offline, so poll immediately.
|
||||||
host.pollServer(function() {
|
host.pollServer(function() {
|
||||||
if (host.online) {
|
if (host.online) {
|
||||||
$("#hostgrid-" + host.serverUid).removeClass('host-cell-inactive');
|
el.classList.remove('host-cell-inactive')
|
||||||
} else {
|
} else {
|
||||||
$("#hostgrid-" + host.serverUid).addClass('host-cell-inactive');
|
el.classList.add('host-cell-inactive')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now start background polling
|
// Now start background polling
|
||||||
@ -147,9 +148,9 @@ function beginBackgroundPollingOfHost(host) {
|
|||||||
// every 5 seconds, poll at the address we know it was live at
|
// every 5 seconds, poll at the address we know it was live at
|
||||||
host.pollServer(function() {
|
host.pollServer(function() {
|
||||||
if (host.online) {
|
if (host.online) {
|
||||||
$("#hostgrid-" + host.serverUid).removeClass('host-cell-inactive');
|
el.classList.remove('host-cell-inactive')
|
||||||
} else {
|
} else {
|
||||||
$("#hostgrid-" + host.serverUid).addClass('host-cell-inactive');
|
el.classList.add('host-cell-inactive')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user