openmrs-esm-core

O3 Framework / getVisitStore

Function: getVisitStore()

getVisitStore(): StoreApi<VisitStoreState>

Defined in: packages/framework/esm-emr-api/src/visit-utils.ts:78

Returns the global visit store that manages the current visit state. The store contains information about the current patient’s visit and provides methods for subscribing to visit state changes.

Returns

StoreApi<VisitStoreState>

The global visit store instance.

Example

import { getVisitStore } from '@openmrs/esm-framework';
const store = getVisitStore();
const unsubscribe = store.subscribe((state) => {
  console.log('Current patient:', state.patientUuid);
});