All files / platform/core/src/hooks useDisplaySetOrder.ts

0% Statements 0/8
0% Branches 0/7
0% Functions 0/2
0% Lines 0/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16                               
import { useSystem } from '../contextProviders/SystemProvider';
import type { DisplaySetOrder } from '../services/DisplaySetService/DisplaySetService';
import type { DisplaySet } from '../types';
 
/**
 * Returns a getter for the active display sets in the named order. The getter
 * reads the order when it is called, so a component does not re-render when
 * the order changes. A component that must re-render subscribes to
 * `DISPLAY_SET_ORDER_CHANGED` and `DISPLAY_SETS_CHANGED`.
 */
export Ifunction useDisplaySetOrder(order: DisplaySetOrder = 'default'): () => DisplaySet[] {
  const { servicesManager } = useSystem();
  const { displaySetService } = servicesManager.services;
  return () => displaySetService.getDisplaySets({ order });
}