Skip to main content

Polyfills and runtime setup

The polyfill APIs are exported from the package root because they must run before the client is created. They are backed by @medplum/expo-polyfills.

import {
ExpoClientStorage,
polyfillMedplumWebAPIs,
} from "@ovok/native";

polyfillMedplumWebAPIs();

const storage = new ExpoClientStorage();

Public exports​

ExportPurpose
polyfillMedplumWebAPIsInstalls the web APIs required by the mobile Medplum/Ovok client
cleanupMedplumWebAPIsRemoves the installed polyfills for tests or controlled teardown
ExpoClientStorageClient storage implementation backed by Expo storage primitives
ExtendedExpoCryptoExpo-compatible crypto implementation
IExpoClientStorageStorage adapter type
PolyfillEnabledConfigOptional polyfill configuration type
initWebSocketManagerInitializes the WebSocket manager used by the client runtime

Call polyfillMedplumWebAPIs once from the application entry point, before creating or using OvokClient. Do not call it during render or once per screen. Use cleanupMedplumWebAPIs only when a test or controlled runtime teardown needs to remove the globals.

Storage and credentials​

ExpoClientStorage provides the client storage boundary; it does not decide which account or patient is active. For credentials needed after an Android background relaunch, use the dedicated adapter from @ovok/native/background-sync.

Public import boundary​

There is no documented @ovok/native/polyfills subpath in the package export map. Import these APIs from @ovok/native even when the rest of the app uses focused subpaths.