The CloseEvent()
constructor creates a new CloseEvent
.
event = new CloseEvent(typeArg, closeEventInit);
DOMString
representing the name of the event.CloseEventInit
dictionary, having the following fields: "wasClean"
, optional and defaulting to false
, of type long
, indicates if the connection has been closed cleanly or not."code"
, optional and defaulting to 0
, of type unsigned short
, that is the connection close code sent by the server."reason"
, optional and defaulting to ''
, of type DOMString
, that is a human-readable reason why the server closed the connection.The CloseEventInit
dictionary also accepts fields from the EventInit
dictionary.
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'CloseEvent()' in that specification. | Living Standard | Initial definition. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | ? | ? | 8 | ? | ? | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | ? | ? | ? | 8 | ? | ? | ? |
CloseEvent
, the interface of the objects it constructs.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/CloseEvent