Skip to content

Commit a80510b

Browse files
committed
update webpack file
1 parent c9e1083 commit a80510b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

example/eventsource-polyfill.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6382,7 +6382,7 @@ function EventSource (url, eventSourceInitDict) {
63826382
var options = parse(url)
63836383
var isSecure = options.protocol === 'https:'
63846384
if (eventSourceInitDict && eventSourceInitDict.skipDefaultHeaders) {
6385-
options.headers = {};
6385+
options.headers = {}
63866386
} else {
63876387
options.headers = { 'Cache-Control': 'no-cache', 'Accept': 'text/event-stream' }
63886388
}
@@ -6653,10 +6653,16 @@ EventSource.prototype.OPEN = 1
66536653
EventSource.prototype.CLOSED = 2
66546654

66556655
/**
6656-
* Identifies this EventSource polyfill as supporting setting the
6657-
* method used for connecting to the SSE stream.
6656+
* Adds the EventSource.supportedOptions property that allows application code to know which
6657+
* custom options are supported by this polyfill.
66586658
*/
6659-
Object.defineProperty(EventSource, 'supportsSettingMethod', {enumerable: true, value: true})
6659+
var supportedOptions = [ 'headers', 'https', 'method', 'proxy', 'skipDefaultHeaders', 'withCredentials' ]
6660+
var supportedOptionsObject = {}
6661+
for (var i in supportedOptions) {
6662+
Object.defineProperty(supportedOptionsObject, supportedOptions[i], {enumerable: true, value: true})
6663+
// Using custom properties for this allows us to make them read-only.
6664+
}
6665+
Object.defineProperty(EventSource, 'supportedOptions', {enumerable: true, value: supportedOptionsObject})
66606666

66616667
/**
66626668
* Closes the connection, if one is made, and sets the readyState attribute to 2 (closed)

0 commit comments

Comments
 (0)