🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@tonconnect/isomorphic-eventsource

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tonconnect/isomorphic-eventsource

This package provides `EventSource` applicable in different environments (browser & NodeJS).

0.0.2
latest
Source
npm
Version published
Weekly downloads
32K
2.02%
Maintainers
4
Weekly downloads
 
Created
Source

@tonconnect/isomorphic-eventsource

This package provides EventSource applicable in different environments (browser & NodeJS).

Get started

npm i @tonconnect/isomorphic-eventsource

How to use

Just import the package and use global EventSource constructor:

import '@tonconnect/isomorphic-eventsource';

const eventSourceInstance = new EventSource();

That will work in both browser and NodeJS.

How does it work

This package exports an empty script if bundler creates browser-compatible build. When package is imported in NodeJS environment, it assigns an EventSource imported from the eventsource package to the global variable.

Note that this package doesn't provide an EventSource polyfill for browsers which doesn't support EventSource natively.

Keywords

ton-connect

FAQs

Package last updated on 06 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts