mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-27 14:43:14 -05:00
1. Added polyfill for Array.findIndex() if missing
2. Added try/catch around indentiers module
This commit is contained in:
parent
b58d7837a3
commit
1574a9bec9
@ -46,6 +46,27 @@ var MESHRIGHT_CHATNOTIFY = 16384;
|
|||||||
var MESHRIGHT_UNINSTALL = 32768;
|
var MESHRIGHT_UNINSTALL = 32768;
|
||||||
var MESHRIGHT_NODESKTOP = 65536;
|
var MESHRIGHT_NODESKTOP = 65536;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Object.defineProperty(Array.prototype, 'findIndex', {
|
||||||
|
value: function (func)
|
||||||
|
{
|
||||||
|
var i = 0;
|
||||||
|
for (i = 0; i < this.length; ++i)
|
||||||
|
{
|
||||||
|
if (func(this[i], i, this))
|
||||||
|
{
|
||||||
|
return (i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (x)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
if (require('MeshAgent').ARCHID == null) {
|
if (require('MeshAgent').ARCHID == null) {
|
||||||
var id = null;
|
var id = null;
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
@ -409,7 +430,10 @@ if ((require('fs').existsSync(process.cwd() + 'batterystate.txt')) && (require('
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
// Setup normal battery monitoring
|
// Setup normal battery monitoring
|
||||||
if (require('identifiers').isBatteryPowered && require('identifiers').isBatteryPowered()) {
|
if (require('identifiers').isBatteryPowered && require('identifiers').isBatteryPowered()) {
|
||||||
require('MeshAgent')._battLevelChanged = function _battLevelChanged(val) {
|
require('MeshAgent')._battLevelChanged = function _battLevelChanged(val) {
|
||||||
@ -432,6 +456,10 @@ else {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(e)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user