Skip to content

Conversation

@nickpresta
Copy link
Contributor

Problem

When running this script in Internet Explorer, MS Edge, Safari <9, etc, you get an error when utilizing the Streaming API, as these browsers don't have EventSource defined. See caniuse for more information.

In addition, this wasn't clear or obvious at all from the README.

Proposed Solution

Obviously EventSource can be polyfilled (around ~25KB minified and gzipped with eventsource for example) but it seems safe and reasonable to just ignore streaming functionality in browsers without support (either native or through polyfill) for EventSource.

The consumers of this client could also take special care to not use the Streaming API with non-compliant browsers, but this means the internal implementation of the client are leaked, not as future-proof, and arduous to implement/remember.

I added a simple test that checks things don't explode when window.EventSource is undefined.

I added an entry in the CHANGELOG, the README, and bumped the package version. Let me know if this is something you do at release time and I can revert the changes to package.json and CHANGELOG.

Thanks.

@nickpresta nickpresta force-pushed the add-ie-edge-support branch from 3eaa268 to b3ee87b Compare August 24, 2016 00:17
@nickpresta nickpresta force-pushed the add-ie-edge-support branch from b3ee87b to f43f842 Compare August 24, 2016 00:18
* Chrome (any recent)
* Firefox (any recent)
* Safari (any recent)*
* Internet Explorer (IE10+)*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only tested this in IE10. IE8,9 may be supported but I wasn't able to confirm.

@apucacao
Copy link
Contributor

Sorry for the delay @nickpresta . This is great. Thank you.

Only thing I'll add is a link to the EventSource polyfill for convenience.

👍

@apucacao apucacao merged commit 0095ac8 into launchdarkly:master Aug 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants