Files
NODEDC_MISSION_CORE/packages/sensor-ui/src/presence.ts
T

8 lines
402 B
TypeScript

import type {Sensor,SensorInventory} from './contracts';
// Persistent identity/settings are not evidence that an instance is present.
// Both Core and Node use the same live inventory projection, keyed by device ID.
export function visibleSensors(inventory:SensorInventory|null,fresh:boolean):Sensor[]{
return fresh&&inventory?.fresh!==false?inventory?.items.filter(device=>device.online)??[]:[];
}