Polyfills
Install the runtime APIs the Ovok client needs before the app loads.
- Stable unknown
- Release candidate since 1.16.1-rc.3
- Development since 1.16.1-dev.2111+9796905
@ovok/native/polyfills installs the web APIs that the Ovok client expects and React
Native lacks: crypto, location, sessionStorage, TextEncoder, btoa and Event.
It is a separate subpath so it can run before the rest of the SDK is imported.
Install them at app start
Call polyfillOvokWebAPIs once from the app's entry file, before the router loads
the app and before any client is created.
// index.js, set as "main" in package.json
const { polyfillOvokWebAPIs } = require("@ovok/native/polyfills");
polyfillOvokWebAPIs();
require("expo-router/entry");Keep this file in CommonJS: a static import of the app would evaluate SDK modules
before the polyfills exist. Pass a config object to skip individual polyfills, and call
cleanupOvokNativeRuntime only in tests that need the original globals back.
Related
API reference
Every export of @ovok/native/polyfills, with signatures, props and types, is in the polyfills API reference.
Last updated on