@labir/react-bridge
Hooks

Hooks

Using hooks, React components know and manipulate the structure classes and the properties of the global ThermalManager object.

Getting structure ojects

  • useThermalManager - get the global instance of ThermalManager
  • useThermalRegistry( registryId, options ) - create or get an instance of ThermalRegistry

Properties that might be manipulated from React

  • useThermalManagerPaletteDrive - color palette
  • useThermalRegistryOpacityDrive - IR / VISIBLE ratio
  • useThermalRegistryRangeDrive - adjustable temperature range
  • useThermalGroupCursorPositionDrive - cursor synchronisation

States of which React needs to know

  • useThermalRegistryHistogramState exposes the current histogram
  • useThermalRegistryLoadingState exposes current loading state
  • useThermalRegistryMinmaxState exposes the min & max temperature of a registry
  • useThermalGroupMinmaxState exposes the min & max temperature of a group

Hooks for components

Many actions related to thermal display, we need buttons, dropdowns and other common components. For those, there are hooks, that takes care of the inner logic.

See [Components][components] page for details.

Listing

  • useThermalRegistryGroupsState groups in a registry
  • useThermalGroupInstancesState file instances in a group

Complex scenarios

There are hooks simplifying the most common use cases:

useSingleFileRegistry

  • Intended for display of one single image in an isolated registry
  • Handles its loading
  • Creates an isolated registry for this particular file

Utility hooks

useThermalObjectPurpose - creates unique ID for individual components