2.0.0 • Published 10 months ago

@falcondev-oss/expo-event-source-polyfill v2.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 months ago

Expo EventSource polyfill

This package provides a polyfill for the EventSource API in Expo using expo/fetch. By using Expo's fetch implementation we don't rely on polling as a workaround since it supports streaming out of the box.

!WARNING Only works with Expo v52 and above.

Installation

npm install @falcondev-oss/expo-event-source-polyfill

Usage

Create an index.js file in the root of your project with the following content:

import { ExpoEventSource } from '@falcondev-oss/expo-event-source-polyfill'
// @ts-expect-error this is used internally and the recommended way to polyfill global objects
import { polyfillGlobal } from 'react-native/Libraries/Utilities/PolyfillFunctions'

import 'expo-router/entry'

polyfillGlobal('EventSource', () => ExpoEventSource)

Then, add the following to your package.json:

{
  "main": "index.js"
}
2.0.0

10 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago