Minimum Common Web Platform API
A subset of standardized Web Platform APIs with the option to add others using Turbo Modules.
Overview
The Minimum Common Web Platform API is a curated subset of standardized Web Platform APIs intended to define a minimum set of capabilities common to browser and non-browser JavaScript-based runtime environments. The goal is to support these APIs in React Native and Hermes.
The globalThis
APIs are considered to be independent of multi-window concerns for user interfaces. See window
for more.
Add APIs using Turbo Modules
Web APIs can also be implemented on native via Turbo Modules and do not require dedicated intregration with React Strict DOM. See this localStorage
implementation for example.
Compatibility
Web APIs | Android | iOS | Issue # |
---|---|---|---|
AbortController | ❌ | ❌ | |
AbortSignal | ❌ | ❌ | |
Blob | ✅ | ✅ | |
Crypto | ❌ | ❌ | |
CustomEvent() constructor | ❌ | ❌ | |
Event() constructor | ❌ | ❌ | |
EventTarget.addEventListener() | ❌ | ❌ | #37 |
EventTarget.dispatchEvent() | ❌ | ❌ | #37 |
EventTarget.removeEventListener() | ❌ | ❌ | #37 |
fetch | ✅ Partial | ✅ Partial | |
FileReader | ✅ | ✅ | |
URL | ❌ | ❌ |
globalThis | Android | iOS | Issue # |
---|---|---|---|
globalThis.atob() | ✅ | ✅ | |
globalThis.btoa() | ✅ | ✅ | |
globalThis.clearInterval() | ✅ | ✅ | |
globalThis.clearTimeout() | ✅ | ✅ | |
globalThis.console | ✅ | ✅ | |
globalThis.crypto | ❌ | ❌ | |
globalThis.fetch() | ✅ | ✅ | |
globalThis.performance.clearMarks() | ✅ | ✅ | |
globalThis.performance.clearMeasures() | ✅ | ✅ | |
globalThis.performance.getEntries() | ✅ | ✅ | |
globalThis.performance.getEntriesByName() | ✅ | ✅ | |
globalThis.performance.getEntriesByType() | ✅ | ✅ | |
globalThis.performance.mark | ✅ | ✅ | |
globalThis.performance.measure() | ✅ | ✅ | |
globalThis.performance.now() | ✅ | ✅ | |
globalThis.performance.timeOrigin | ❌ | ❌ | |
globalThis.queueMicrotask() | ✅ | ✅ | |
globalThis.setInterval() | ✅ | ✅ | |
globalThis.setTimeout() | ✅ | ✅ |