mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-17 08:36:42 +00:00
Speed up click on host by using cached serverinfo
This commit is contained in:
parent
9401443c4f
commit
682246fa27
@ -213,22 +213,28 @@ function hostChosen(sourceEvent) {
|
||||
}
|
||||
|
||||
api = hosts[serverUid];
|
||||
if(!!api.refreshServerInfo == false) { // bang bang, you're a bool (cast the function into truthiness to check for existance)
|
||||
console.log('error: revival of object failed!');
|
||||
}
|
||||
stopBackgroundPollingOfHost(api);
|
||||
|
||||
// Use the cached state of this host from the last poll
|
||||
if(!api.paired) {
|
||||
// It doesn't think we're paired. Refresh our serverinfo to make sure.
|
||||
api.refreshServerInfo().then(function (ret) {
|
||||
if (!api.paired) {
|
||||
// Still not paired; go to the pairing flow
|
||||
pairTo(api, function(){ showApps(api); saveHosts();}, function(){});
|
||||
} else {
|
||||
// When we queried again, it was paired, so show apps.
|
||||
showApps(api);
|
||||
}
|
||||
stopBackgroundPollingOfHost(api);
|
||||
}, function (failedRefreshInfo) {
|
||||
snackbarLog('Failed to connect to ' + api.address + '! Are you sure the host is on?');
|
||||
console.log('Returned error was: ' + failedRefreshInfo);
|
||||
console.log('failed API object: ');
|
||||
console.log(api.toString());
|
||||
});
|
||||
} else {
|
||||
showApps(api);
|
||||
}
|
||||
}
|
||||
|
||||
// the `+` was selected on the host grid.
|
||||
|
Loading…
x
Reference in New Issue
Block a user