Adjusted signal strength drops.
This commit is contained in:
parent
20ea388c24
commit
4adf3d80a1
1 changed files with 6 additions and 5 deletions
|
@ -416,7 +416,9 @@ window.Umi = { UI: {}, Protocol: { SockChat: { Protocol: {} } } };
|
||||||
}, 'Clear Logs');
|
}, 'Clear Logs');
|
||||||
|
|
||||||
const pingIndicator = new MamiPingIndicator;
|
const pingIndicator = new MamiPingIndicator;
|
||||||
const pingToggle = Umi.UI.Toggles.Add('ping', undefined, 'Ready!');
|
const pingToggle = Umi.UI.Toggles.Add('ping', {
|
||||||
|
click: () => alert(pingToggle.title),
|
||||||
|
}, 'Ready!');
|
||||||
pingToggle.appendChild(pingIndicator.getElement());
|
pingToggle.appendChild(pingIndicator.getElement());
|
||||||
console.log(pingIndicator);
|
console.log(pingIndicator);
|
||||||
|
|
||||||
|
@ -614,16 +616,15 @@ window.Umi = { UI: {}, Protocol: { SockChat: { Protocol: {} } } };
|
||||||
Umi.Server.watch('ping:long', long => {
|
Umi.Server.watch('ping:long', long => {
|
||||||
if(dumpEvents) console.log('ping:long', long);
|
if(dumpEvents) console.log('ping:long', long);
|
||||||
|
|
||||||
pingToggle.title = 'Taking longer than 2 seconds';
|
pingToggle.title = '+2000ms';
|
||||||
pingIndicator.setStrength(0);
|
pingIndicator.setStrength(0);
|
||||||
});
|
});
|
||||||
Umi.Server.watch('ping:recv', recv => {
|
Umi.Server.watch('ping:recv', recv => {
|
||||||
if(dumpEvents) console.log('ping:recv', recv);
|
if(dumpEvents) console.log('ping:recv', recv);
|
||||||
|
|
||||||
let strength = 3;
|
let strength = 3;
|
||||||
if(recv.diff > 45) --strength;
|
if(recv.diff > 1000) --strength;
|
||||||
if(recv.diff > 30) --strength;
|
if(recv.diff > 250) --strength;
|
||||||
if(recv.diff > 15) --strength;
|
|
||||||
|
|
||||||
pingToggle.title = `${recv.diff.toLocaleString()}ms`;
|
pingToggle.title = `${recv.diff.toLocaleString()}ms`;
|
||||||
pingIndicator.setStrength(strength);
|
pingIndicator.setStrength(strength);
|
||||||
|
|
Loading…
Reference in a new issue