2025-01-15 19:42:35 +01:00

152 lines
20 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en"><!-- use theme color or fallback -->
<!--use textcolor from settings, otherwise create a contrasting color to theme color-->
<head><meta charset="utf-8"/><link href="../../bootstrap/css/bootstrap.min.css" rel="stylesheet"/><link href="../../bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet"/><link href="../../bootstrap/css/bootstrap-select.min.css" rel="stylesheet"/><link href="http://fonts.googleapis.com/css?family=Open+Sans:400,700,700italic,400italic" rel="stylesheet" type="text/css"/><link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,600,600italic,400" rel="stylesheet" type="text/css"/><link href="http://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css" rel="stylesheet" type="text/css"/><script src="../../jquery-1.9.1.min.js"></script><script src="../../bootstrap/js/bootstrap.min.js"></script><script src="../../bootstrap/js/bootstrap-select.min.js"></script><link href="../../styles.css" rel="stylesheet"/><link href="../../haxe-nav.css" rel="stylesheet"/><script type="text/javascript">var dox = {rootPath: "../../",platforms: ["Neko","Android","Flash","iOS","macOS","Linux","HTML5","Windows"]};</script><script type="text/javascript" src="../../nav.js"></script><script type="text/javascript" src="../../index.js"></script><link rel="icon" href="../../favicon.ico" type="image/x-icon"></link><title>js.html.CloseEvent - API Reference</title><meta name="description" content="A &lt;code&gt;&lt;a href="../../js/html/CloseEvent.html"&gt;CloseEvent&lt;/a&gt;&lt;/code&gt; is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the &lt;code&gt;&lt;a href="../../js/html/WebSocket.html"&gt;WebSocket&lt;/a&gt;&lt;/code&gt; object's &lt;code&gt;onclose&lt;/code&gt; attribute."/></head><body><style>
a, code .type {
color: #24afc4;
}
.navbar .brand {
display: inline-block;
float: none;
text-shadow: 0 0 0 transparent;
}
.nav-list>.active>a.treeLink, .nav-list>.active>a.treeLink:hover, .nav-list>.active>a.treeLink:focus {
background: #24afc4;
color: #ffffff;
text-shadow: 0 0 0 transparent;
}
.navbar .container {
width: 940px ;
}
@media (max-width: 767px) {
.navbar .container {
width: auto;
}
}
@media (max-width: 979px) and (min-width: 768px) {
.navbar .container {
width: 724px;
}
}
@media (min-width: 1200px) {
.navbar .container {
width: 1170px;
}
}
.navbar .container img {
margin: 5px 0 0 4px;
}
</style><nav class="nav"><div class="navbar"><div class="navbar-inner" style="background:#FAFAFA; border-bottom:1px solid rgba(0,0,0,.09)"><div class="container"><a class="brand" href="http://www.openfl.org"><img alt="" src="http://www.openfl.org/images/logo.png"/></a><a class="brand" style="color:#777777" href="../../">API Reference</a></div></div></div></nav><div class="container main-content"><div class="row-fluid"><div class="span3"><div class="well sidebar-nav"><form class="form-search" id="searchForm"><div class="input-prepend input-block-level"><span class="add-on"><i class="icon-search"></i></span><input id="search" type="text" placeholder="Search" autocomplete="off"/></div></form><div class="dropdown"><select id="select-platform" class="selectpicker" title="Filter by platform" data-width="100%"><option value="all" selected="true">All Platforms</option><option>Neko</option><option>Android</option><option>Flash</option><option>iOS</option><option>macOS</option><option>Linux</option><option>HTML5</option><option>Windows</option></select></div></div><div class="well sidebar-nav"><div id="nav"></div></div></div><div class="span9"><div class="page-header"><h1><small>class</small> CloseEvent</h1><h4><small>package <a href="../../js/html/index.html">js.html</a></small></h4><h4><small>extends <a class="type" title="The Event interface represents any event which takes place in the DOM; some are user-generated (such as mouse or keyboard events), while others are generated by APIs (such as events that indicate an animation has finished running, a video has been paused, and so forth)." href="../../js/html/Event.html">Event</a></small></h4> <p class="availability"><hr/><em>Available on HTML5</em></p></div><div class="body"><div class="doc doc-main"><div class="indent"><p>A <code><a href="../../js/html/CloseEvent.html">CloseEvent</a></code> is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the <code><a href="../../js/html/WebSocket.html">WebSocket</a></code> object's <code>onclose</code> attribute.</p>
<p>Documentation <a href="https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent">CloseEvent</a> by <a href="https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent$history">Mozilla Contributors</a>, licensed under <a href="https://creativecommons.org/licenses/by-sa/2.5/">CC-BY-SA 2.5</a>.</p><p class="javadoc">See:</p><div class="indent inline-content"><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent">https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent</a></p></div></div></div><h3 class="section">Constructor</h3><div class="fields"><div class="field "><a name="new"></a><h3><p><code><a href="#new"><span class="identifier">new</span></a> (<span style="white-space:nowrap">type:<a class="type" title="The basic String class." href="../../String.html">String</a>,</span> <span style="white-space:nowrap">?eventInitDict:<a class="type" title="" href="../../js/html/CloseEventInit.html">CloseEventInit</a></span>)</code></p></h3><div class="doc"><p class="javadoc">Throws:</p><table class="table table-bordered params"><div class="indent inline-content"><tr><th width="25%"><code>null</code></th><td><p>DOMError</p></td></tr></div></table></div></div></div><h3 class="section">Variables</h3><div class="fields"><div class="field "><a name="code"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/CloseEvent.html#code"><span class="identifier">code</span></a>:<a class="type" title="The standard Int type." href="../../Int.html">Int</a></code></p></h3><div class="doc"><p>Returns an <code>unsigned short</code> containing the close code send by the server. The following values are permitted status codes.
<table id="Status_codes" class="standard-table"></p>
<p><tr>
<td class="header">Status code</td>
<td class="header">Name</td>
<td class="header">Description</td>
</tr>
<tr>
<td><code>0</code><code>999</code></td>
<td> </td>
<td>Reserved and not used.</td>
</tr>
<tr>
<td><code>1000</code></td>
<td><code>CLOSE_NORMAL</code></td>
<td>Normal closure; the connection successfully completed whatever purpose for which it was created.</td>
</tr>
<tr>
<td><code>1001</code></td>
<td><code>CLOSE_GOING_AWAY</code></td>
<td>The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection.</td>
</tr>
<tr>
<td><code>1002</code></td>
<td><code>CLOSE_PROTOCOL_ERROR</code></td>
<td>The endpoint is terminating the connection due to a protocol error.</td>
</tr>
<tr>
<td><code>1003</code></td>
<td><code>CLOSE_UNSUPPORTED</code></td>
<td>The connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data).</td>
</tr>
<tr>
<td><code>1004</code></td>
<td> </td>
<td>Reserved. A meaning might be defined in the future.</td>
</tr>
<tr>
<td><code>1005</code></td>
<td><code>CLOSE_NO_STATUS</code></td>
<td>Reserved.  Indicates that no status code was provided even though one was expected.</td>
</tr>
<tr>
<td><code>1006</code></td>
<td><code>CLOSE_ABNORMAL</code></td>
<td>Reserved. Used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected.</td>
</tr>
<tr>
<td><code>1007</code></td>
<td>Unsupported Data</td>
<td>The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message).</td>
</tr>
<tr>
<td><code>1008</code></td>
<td>Policy Violation</td>
<td>The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable.</td>
</tr>
<tr>
<td><code>1009</code></td>
<td><code>CLOSE_TOO_LARGE</code></td>
<td>The endpoint is terminating the connection because a data frame was received that is too large.</td>
</tr>
<tr>
<td><code>1010</code></td>
<td>Missing Extension</td>
<td>The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't.</td>
</tr>
<tr>
<td><code>1011</code></td>
<td>Internal Error</td>
<td>The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.</td>
</tr>
<tr>
<td><code>1012</code></td>
<td>Service Restart</td>
<td>The server is terminating the connection because it is restarting. [Ref]</td>
</tr>
<tr>
<td><code>1013</code></td>
<td>Try Again Later</td>
<td>The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients. [Ref]</td>
</tr>
<tr>
<td><code>1014</code></td>
<td> </td>
<td>Reserved for future use by the WebSocket standard.</td>
</tr>
<tr>
<td><code>1015</code></td>
<td>TLS Handshake</td>
<td>Reserved. Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified).</td>
</tr>
<tr>
<td><code>1016</code><code>1999</code></td>
<td> </td>
<td>Reserved for future use by the WebSocket standard.</td>
</tr>
<tr>
<td><code>2000</code><code>2999</code></td>
<td> </td>
<td>Reserved for use by WebSocket extensions.</td>
</tr>
<tr>
<td><code>3000</code><code>3999</code></td>
<td> </td>
<td>Available for use by libraries and frameworks. May not be used by applications. Available for registration at the IANA via first-come, first-serve.</td>
</tr>
<tr>
<td><code>4000</code><code>4999</code></td>
<td> </td>
<td>Available for use by applications.</td>
</tr></p>
<p></table></p></div></div><div class="field "><a name="reason"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/CloseEvent.html#reason"><span class="identifier">reason</span></a>:<a class="type" title="The basic String class." href="../../String.html">String</a></code></p></h3><div class="doc"><p>Returns a <code>DOMString</code> indicating the reason the server closed the connection. This is specific to the particular server and sub-protocol.</p></div></div><div class="field "><a name="wasClean"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/CloseEvent.html#wasClean"><span class="identifier">wasClean</span></a>:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a></code></p></h3><div class="doc"><p>Returns a <code>Boolean</code> that Indicates whether or not the connection was cleanly closed.</p></div></div></div> <div class="inherited-fields well"><h3 class="section">Inherited Variables</h3><div class="fields"><h4><a href="#" class="expand-button"><i class="fa fa-arrow-circle-o-right"></i></a> Defined by <a class="type" title="The Event interface represents any event which takes place in the DOM; some are user-generated (such as mouse or keyboard events), while others are generated by APIs (such as events that indicate an animation has finished running, a video has been paused, and so forth)." href="../../js/html/Event.html">Event</a></h4><div style="display:none"><div class="field "><a name="bubbles"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/Event.html#bubbles"><span class="identifier">bubbles</span></a>:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a></code></p></h3><div class="doc"><p>A Boolean indicating whether the event bubbles up through the DOM or not.</p></div></div><div class="field "><a name="cancelable"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/Event.html#cancelable"><span class="identifier">cancelable</span></a>:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a></code></p></h3><div class="doc"><p>A Boolean indicating whether the event is cancelable.</p></div></div><div class="field "><a name="currentTarget"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/Event.html#currentTarget"><span class="identifier">currentTarget</span></a>:<a class="type" title="EventTarget is an interface implemented by objects that can receive events and may have listeners for them." href="../../js/html/EventTarget.html">EventTarget</a></code></p></h3><div class="doc"><p>A reference to the currently registered target for the event. This is the object to which the event is currently slated to be sent to; it's possible this has been changed along the way through retargeting.</p></div></div><div class="field "><a name="defaultPrevented"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/Event.html#defaultPrevented"><span class="identifier">defaultPrevented</span></a>:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a></code></p></h3><div class="doc"><p>Indicates whether or not <code>event.preventDefault()</code> has been called on the event.</p></div></div><div class="field "><a name="eventPhase"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/Event.html#eventPhase"><span class="identifier">eventPhase</span></a>:<a class="type" title="The standard Int type." href="../../Int.html">Int</a></code></p></h3><div class="doc"><p>Indicates which phase of the event flow is being processed.</p></div></div><div class="field "><a name="explicitOriginalTarget"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/Event.html#explicitOriginalTarget"><span class="identifier">explicitOriginalTarget</span></a>:<a class="type" title="EventTarget is an interface implemented by objects that can receive events and may have listeners for them." href="../../js/html/EventTarget.html">EventTarget</a></code></p></h3><div class="doc"><p>The explicit original target of the event (Mozilla-specific).</p></div></div><div class="field "><a name="isTrusted"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/Event.html#isTrusted"><span class="identifier">isTrusted</span></a>:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a></code></p></h3><div class="doc"><p>Indicates whether or not the event was initiated by the browser (after a user click for instance) or by a script (using an event creation method, like event.initEvent)</p></div></div><div class="field "><a name="originalTarget"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/Event.html#originalTarget"><span class="identifier">originalTarget</span></a>:<a class="type" title="EventTarget is an interface implemented by objects that can receive events and may have listeners for them." href="../../js/html/EventTarget.html">EventTarget</a></code></p></h3><div class="doc"><p>The original target of the event, before any retargetings (Mozilla-specific).</p></div></div><div class="field "><a name="target"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/Event.html#target"><span class="identifier">target</span></a>:<a class="type" title="EventTarget is an interface implemented by objects that can receive events and may have listeners for them." href="../../js/html/EventTarget.html">EventTarget</a></code></p></h3><div class="doc"><p>A reference to the target to which the event was originally dispatched.</p></div></div><div class="field "><a name="timeStamp"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/Event.html#timeStamp"><span class="identifier">timeStamp</span></a>:<a class="type" title="The standard Float type, this is a double-precision IEEE 64bit float." href="../../Float.html">Float</a></code></p></h3><div class="doc"><p>The time at which the event was created, in milliseconds. By specification, this value is time since epoch, but in reality browsers' definitions vary; in addition, work is underway to change this to be a <code>DOMHighResTimeStamp</code> instead.</p></div></div><div class="field "><a name="type"></a><h3><p><code><span class="label">read only</span><a href="../../js/html/Event.html#type"><span class="identifier">type</span></a>:<a class="type" title="The basic String class." href="../../String.html">String</a></code></p></h3><div class="doc"><p>The name of the event (case-insensitive).</p></div></div></div></div><h3 class="section">Inherited Methods</h3><div class="fields"><h4><a href="#" class="expand-button"><i class="fa fa-arrow-circle-o-right"></i></a> Defined by <a class="type" title="The Event interface represents any event which takes place in the DOM; some are user-generated (such as mouse or keyboard events), while others are generated by APIs (such as events that indicate an animation has finished running, a video has been paused, and so forth)." href="../../js/html/Event.html">Event</a></h4><div style="display:none"><div class="field "><a name="getPreventDefault"></a><h3><p><code><a href="#getPreventDefault"><span class="identifier">getPreventDefault</span></a> ():<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a></code></p></h3><div class="doc"><p>Non-standard. Returns the value of <code><a href="../../js/html/Event.html#defaultPrevented">Event.defaultPrevented</a></code>. Use <code><a href="../../js/html/Event.html#defaultPrevented">Event.defaultPrevented</a></code> instead.</p></div></div><div class="field "><a name="initEvent"></a><h3><p><code><a href="#initEvent"><span class="identifier">initEvent</span></a> (<span style="white-space:nowrap">type:<a class="type" title="The basic String class." href="../../String.html">String</a>,</span> <span style="white-space:nowrap">bubbles:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a>,</span> <span style="white-space:nowrap">cancelable:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a></span>):<a class="type" title="The standard Void type." href="../../Void.html">Void</a></code></p></h3><div class="doc"><p>Initializes the value of an Event created. If the event has already being dispatched, this method does nothing.</p></div></div><div class="field "><a name="preventDefault"></a><h3><p><code><a href="#preventDefault"><span class="identifier">preventDefault</span></a> ():<a class="type" title="The standard Void type." href="../../Void.html">Void</a></code></p></h3><div class="doc"><p>Cancels the event (if it is cancelable).</p></div></div><div class="field "><a name="stopImmediatePropagation"></a><h3><p><code><a href="#stopImmediatePropagation"><span class="identifier">stopImmediatePropagation</span></a> ():<a class="type" title="The standard Void type." href="../../Void.html">Void</a></code></p></h3><div class="doc"><p>For this particular event, no other listener will be called. Neither those attached on the same element, nor those attached on elements which will be traversed later (in capture phase, for instance)</p></div></div><div class="field "><a name="stopPropagation"></a><h3><p><code><a href="#stopPropagation"><span class="identifier">stopPropagation</span></a> ():<a class="type" title="The standard Void type." href="../../Void.html">Void</a></code></p></h3><div class="doc"><p>Stops the propagation of events further along in the DOM.</p></div></div></div></div></div></div></div></div></div><footer class="section site-footer" style="background:#FAFAFA"><div class="container"><div class="copyright"><p style="color:#777777">&copy; 2017 &nbsp;<a style="color:#777777" href="http://www.openfl.org">http://www.openfl.org</a></p></div></div></footer><script src="../..//highlighter.js"></script><link href="../../highlighter.css" rel="stylesheet"/></body></html>