Skip to content
Permalink
Browse files

[giow] (0) Add BroadcastChannel.close()

Affected topics: DOM APIs

git-svn-id: http://svn.whatwg.org/webapps@8661 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Jun 6, 2014
1 parent 300e7de commit 5a738409e4c513e0311a6ab76bdc85a14ff22d58
Showing with 90 additions and 15 deletions.
  1. +29 −5 complete.html
  2. +29 −5 index
  3. +32 −5 source
interface <dfn id=broadcastchannel>BroadcastChannel</dfn> : <a href=#eventtarget>EventTarget</a> {
readonly attribute DOMString <a href=#dom-broadcastchannel-name title=dom-BroadcastChannel-name>name</a>;
void <a href=#dom-broadcastchannel-postmessage title=dom-BroadcastChannel-postMessage>postMessage</a>(any message);
void <a href=#dom-broadcastchannel-close title=dom-BroadcastChannel-close>close</a>();
attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-broadcastchannel-onmessage title=handler-BroadcastChannel-onmessage>onmessage</a>;
};</pre>


</dd>

<dt><var title="">broadcastChannel</var> . <code title=dom-BroadcastChannel-close><a href=#dom-broadcastchannel-close>close</a></code>()</dt>

<dd>

<p>Closes the <code><a href=#broadcastchannel>BroadcastChannel</a></code> object, opening it up to garbage collection.</p>

</dd>

</dl><div class=impl>

<p>A <code><a href=#broadcastchannel>BroadcastChannel</a></code> object has a <dfn id=channel-name>channel name</dfn> and a
<dfn id=broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</dfn>.</p>
<p>A <code><a href=#broadcastchannel>BroadcastChannel</a></code> object has a <dfn id=channel-name>channel name</dfn>, a
<dfn id=broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</dfn>, and a <dfn id=concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</dfn>.</p>

<p>The <dfn id=dom-broadcastchannel title=dom-BroadcastChannel><code>BroadcastChannel()</code></dfn> constructor, when
invoked, must create and return a <code><a href=#broadcastchannel>BroadcastChannel</a></code> object whose <a href=#channel-name>channel
name</a> is the constructor's first argument, and whose <a href=#broadcastchannel-settings-object><code>BroadcastChannel</code>
settings object</a> is the <a href=#incumbent-settings-object>incumbent settings object</a>.</p>
name</a> is the constructor's first argument, whose <a href=#broadcastchannel-settings-object><code>BroadcastChannel</code>
settings object</a> is the <a href=#incumbent-settings-object>incumbent settings object</a>, and whose <a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</a> is false.</p>

<p>The <dfn id=dom-broadcastchannel-name title=dom-BroadcastChannel-name><code>name</code></dfn> attribute must return the
<a href=#channel-name>channel name</a>.</p>

<li><p>Their <a href=#channel-name>channel name</a> is a <a href=#case-sensitive>case-sensitive</a> match for <var title="">source channel</var>.</li>

<li><p>Their <a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</a> is
false.</li>

</ul></li>

<li><p>Remove <var title="">source</var> from <var title="">destinations</var>.</li>

</li>

</ol><p>While a <code><a href=#broadcastchannel>BroadcastChannel</a></code> object has an event listener registered for <code title=event-message><a href=#event-message>message</a></code> events, there must be a strong reference from <a href=#global-object>global
</ol><!--CLEANUP--><p>While a <code><a href=#broadcastchannel>BroadcastChannel</a></code> object whose <a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed
flag</a> is false has an event listener registered for <code title=event-message><a href=#event-message>message</a></code> events, there must be a strong reference from <a href=#global-object>global
object</a> specified by the <code><a href=#broadcastchannel>BroadcastChannel</a></code> object's
<a href=#broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</a> to the <code><a href=#broadcastchannel>BroadcastChannel</a></code>
object itself.</p>

<p>The <dfn id=dom-broadcastchannel-close title=dom-BroadcastChannel-close><code>close()</code></dfn> method must set the
<a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</a> of the
<code><a href=#broadcastchannel>BroadcastChannel</a></code> object on which it was invoked to true.</p>

<p class=note>Authors are strongly encouraged to explicitly close <code><a href=#broadcastchannel>BroadcastChannel</a></code>
objects when they are no longer needed, so that they can be garbage collected. Creating many
<code><a href=#broadcastchannel>BroadcastChannel</a></code> objects and discarding them while leaving them with an event
listener and without closing them can lead to an apparent memory leak, since the objects will
continue to live for as long as they have an event listener (or until their page or worker is
closed).</p>

<hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
handler event type">event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes>event
handler IDL attributes</a>, by all objects implementing the <code><a href=#broadcastchannel>BroadcastChannel</a></code>
34 index
interface <dfn id=broadcastchannel>BroadcastChannel</dfn> : <a href=#eventtarget>EventTarget</a> {
readonly attribute DOMString <a href=#dom-broadcastchannel-name title=dom-BroadcastChannel-name>name</a>;
void <a href=#dom-broadcastchannel-postmessage title=dom-BroadcastChannel-postMessage>postMessage</a>(any message);
void <a href=#dom-broadcastchannel-close title=dom-BroadcastChannel-close>close</a>();
attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-broadcastchannel-onmessage title=handler-BroadcastChannel-onmessage>onmessage</a>;
};</pre>


</dd>

<dt><var title="">broadcastChannel</var> . <code title=dom-BroadcastChannel-close><a href=#dom-broadcastchannel-close>close</a></code>()</dt>

<dd>

<p>Closes the <code><a href=#broadcastchannel>BroadcastChannel</a></code> object, opening it up to garbage collection.</p>

</dd>

</dl><div class=impl>

<p>A <code><a href=#broadcastchannel>BroadcastChannel</a></code> object has a <dfn id=channel-name>channel name</dfn> and a
<dfn id=broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</dfn>.</p>
<p>A <code><a href=#broadcastchannel>BroadcastChannel</a></code> object has a <dfn id=channel-name>channel name</dfn>, a
<dfn id=broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</dfn>, and a <dfn id=concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</dfn>.</p>

<p>The <dfn id=dom-broadcastchannel title=dom-BroadcastChannel><code>BroadcastChannel()</code></dfn> constructor, when
invoked, must create and return a <code><a href=#broadcastchannel>BroadcastChannel</a></code> object whose <a href=#channel-name>channel
name</a> is the constructor's first argument, and whose <a href=#broadcastchannel-settings-object><code>BroadcastChannel</code>
settings object</a> is the <a href=#incumbent-settings-object>incumbent settings object</a>.</p>
name</a> is the constructor's first argument, whose <a href=#broadcastchannel-settings-object><code>BroadcastChannel</code>
settings object</a> is the <a href=#incumbent-settings-object>incumbent settings object</a>, and whose <a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</a> is false.</p>

<p>The <dfn id=dom-broadcastchannel-name title=dom-BroadcastChannel-name><code>name</code></dfn> attribute must return the
<a href=#channel-name>channel name</a>.</p>

<li><p>Their <a href=#channel-name>channel name</a> is a <a href=#case-sensitive>case-sensitive</a> match for <var title="">source channel</var>.</li>

<li><p>Their <a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</a> is
false.</li>

</ul></li>

<li><p>Remove <var title="">source</var> from <var title="">destinations</var>.</li>

</li>

</ol><p>While a <code><a href=#broadcastchannel>BroadcastChannel</a></code> object has an event listener registered for <code title=event-message><a href=#event-message>message</a></code> events, there must be a strong reference from <a href=#global-object>global
</ol><!--CLEANUP--><p>While a <code><a href=#broadcastchannel>BroadcastChannel</a></code> object whose <a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed
flag</a> is false has an event listener registered for <code title=event-message><a href=#event-message>message</a></code> events, there must be a strong reference from <a href=#global-object>global
object</a> specified by the <code><a href=#broadcastchannel>BroadcastChannel</a></code> object's
<a href=#broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</a> to the <code><a href=#broadcastchannel>BroadcastChannel</a></code>
object itself.</p>

<p>The <dfn id=dom-broadcastchannel-close title=dom-BroadcastChannel-close><code>close()</code></dfn> method must set the
<a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</a> of the
<code><a href=#broadcastchannel>BroadcastChannel</a></code> object on which it was invoked to true.</p>

<p class=note>Authors are strongly encouraged to explicitly close <code><a href=#broadcastchannel>BroadcastChannel</a></code>
objects when they are no longer needed, so that they can be garbage collected. Creating many
<code><a href=#broadcastchannel>BroadcastChannel</a></code> objects and discarding them while leaving them with an event
listener and without closing them can lead to an apparent memory leak, since the objects will
continue to live for as long as they have an event listener (or until their page or worker is
closed).</p>

<hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
handler event type">event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes>event
handler IDL attributes</a>, by all objects implementing the <code><a href=#broadcastchannel>BroadcastChannel</a></code>
37 source
interface <dfn>BroadcastChannel</dfn> : <span>EventTarget</span> {
readonly attribute DOMString <span data-x="dom-BroadcastChannel-name">name</span>;
void <span data-x="dom-BroadcastChannel-postMessage">postMessage</span>(any message);
void <span data-x="dom-BroadcastChannel-close">close</span>();
attribute <span>EventHandler</span> <span data-x="handler-BroadcastChannel-onmessage">onmessage</span>;
};</pre>


</dd>

<dt><var data-x="">broadcastChannel</var> . <code data-x="dom-BroadcastChannel-close">close</code>()</dt>

<dd>

<p>Closes the <code>BroadcastChannel</code> object, opening it up to garbage collection.</p>

</dd>

</dl>

<div class="impl">

<p>A <code>BroadcastChannel</code> object has a <dfn>channel name</dfn> and a
<dfn><code>BroadcastChannel</code> settings object</dfn>.</p>
<p>A <code>BroadcastChannel</code> object has a <dfn>channel name</dfn>, a
<dfn><code>BroadcastChannel</code> settings object</dfn>, and a <dfn
data-x="concept-BroadcastChannel-closed">closed flag</dfn>.</p>

<p>The <dfn data-x="dom-BroadcastChannel"><code>BroadcastChannel()</code></dfn> constructor, when
invoked, must create and return a <code>BroadcastChannel</code> object whose <span>channel
name</span> is the constructor's first argument, and whose <span><code>BroadcastChannel</code>
settings object</span> is the <span>incumbent settings object</span>.</p>
name</span> is the constructor's first argument, whose <span><code>BroadcastChannel</code>
settings object</span> is the <span>incumbent settings object</span>, and whose <span
data-x="concept-BroadcastChannel-closed">closed flag</span> is false.</p>

<p>The <dfn data-x="dom-BroadcastChannel-name"><code>name</code></dfn> attribute must return the
<span>channel name</span>.</p>
<li><p>Their <span>channel name</span> is a <span>case-sensitive</span> match for <var
data-x="">source channel</var>.</p></li>

<li><p>Their <span data-x="concept-BroadcastChannel-closed">closed flag</span> is
false.</p></li>

</ul>

</li>

</ol>

<p>While a <code>BroadcastChannel</code> object has an event listener registered for <code
<!--CLEANUP-->
<p>While a <code>BroadcastChannel</code> object whose <span data-x="concept-BroadcastChannel-closed">closed
flag</span> is false has an event listener registered for <code
data-x="event-message">message</code> events, there must be a strong reference from <span>global
object</span> specified by the <code>BroadcastChannel</code> object's
<span><code>BroadcastChannel</code> settings object</span> to the <code>BroadcastChannel</code>
object itself.</p>

<p>The <dfn data-x="dom-BroadcastChannel-close"><code>close()</code></dfn> method must set the
<span data-x="concept-BroadcastChannel-closed">closed flag</span> of the
<code>BroadcastChannel</code> object on which it was invoked to true.</p>

<p class="note">Authors are strongly encouraged to explicitly close <code>BroadcastChannel</code>
objects when they are no longer needed, so that they can be garbage collected. Creating many
<code>BroadcastChannel</code> objects and discarding them while leaving them with an event
listener and without closing them can lead to an apparent memory leak, since the objects will
continue to live for as long as they have an event listener (or until their page or worker is
closed).</p>

<hr>

<p>The following are the <span>event handlers</span> (and their corresponding <span data-x="event

0 comments on commit 5a73840

Please sign in to comment.
You can’t perform that action at this time.