Moved the band array out of the function prototype so it's not created each time

merge-requests/237/merge
Tag 2023-01-22 15:33:50 -08:00
rodzic 902efb82ea
commit a36f22bd92
1 zmienionych plików z 75 dodań i 77 usunięć

Wyświetl plik

@ -1,14 +1,9 @@
// GridTracker Copyright © 2023 GridTracker.org // GridTracker Copyright © 2023 GridTracker.org
// All rights reserved. // All rights reserved.
// See LICENSE for more information. // See LICENSE for more information.
var g_proto_bands = [
// Incoming is already float fixed ( 14.037 ) for 14,037,000hz "OOB",
Number.prototype.formatBand = function ()
{
var freq = this;
var bands = [
"OOB", "OOB",
"0",
1, 1,
"160m", "160m",
3, 3,
@ -77,10 +72,13 @@ Number.prototype.formatBand = function ()
"1.25m", "1.25m",
225, 225,
"1.25m" "1.25m"
]; ];
// Incoming is already float fixed ( 14.037 ) for 14,037,000hz
var newFreq = parseInt(freq); Number.prototype.formatBand = function ()
if (newFreq > 0 && newFreq < 226) return bands[bands.indexOf(newFreq) + 1]; {
let freq = this;
let newFreq = parseInt(freq);
if (newFreq > 0 && newFreq < 226) return g_proto_bands[g_proto_bands.indexOf(newFreq) + 1];
else if (newFreq >= 420 && newFreq <= 450) return "70cm"; else if (newFreq >= 420 && newFreq <= 450) return "70cm";
else if (newFreq >= 902 && newFreq <= 928) return "33cm"; else if (newFreq >= 902 && newFreq <= 928) return "33cm";
else if (newFreq >= 1240 && newFreq <= 1300) return "23cm"; else if (newFreq >= 1240 && newFreq <= 1300) return "23cm";