この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!
この記事を English (US) で読むこともできます。

The CloseEvent() constructor creates a new CloseEvent.

Syntax

 event = new CloseEvent(typeArg, closeEventInit);

Values

typeArg
Is a DOMString representing the name of the event.
closeEventInitOptional
Is a 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.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'CloseEvent()' in that specification.
Living Standard Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome ? Edge ? Firefox Full support 8IE ? Opera ? Safari ? WebView Android ? Chrome Android ? Edge Mobile ? Firefox Android Full support 8Opera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

See also

  • CloseEvent, the interface of the objects it constructs.

ドキュメントのタグと貢献者

このページの貢献者: connorshea, teoli
最終更新者: connorshea,