📄 bieventtarget.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><!--
Generated using api.website.xsl version 2003-07-17
-->
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>BiEventTarget</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="api.css"><script type="text/javascript">
function showDerivedClasses() {
var ul = document.getElementById("api-derived-classes");
var lis = ul.childNodes;
var l = lis.length;
for (var i = 1; i < l; i++)
lis[i].style.display = "";
lis[0].style.display = "none";
}
</script></head>
<body>
<h1 id="BiEventTarget">BiEventTarget</h1>
<p>
This class provides the functionality to add and remove event listeners
as well as dispatchn events. When an event is dispatched the listeners
are notified.
</p>
<p>This class extends
<code><a href="BiObject.html">BiObject</a></code>
and therefore all methods and fields available for
<code><a href="BiObject.html">BiObject</a></code>
are also available for <code>BiEventTarget</code>.</p>
<ul class="partial-class-tree">
<li><code><a href="BiObject.html">BiObject</a></code><ul>
<li><code>BiEventTarget</code><ul id="api-derived-classes"><li><code><a href="javascript:showDerivedClasses()">Show derived classes</a></code></li><li style="display:none"><code><a href="BiApplication.html">BiApplication</a></code></li><li style="display:none"><code><a href="BiCommand.html">BiCommand</a></code></li><li style="display:none"><code><a href="BiComponent.html">BiComponent</a></code></li><li style="display:none"><code><a href="BiDataSet.html">BiDataSet</a></code></li><li style="display:none"><code><a href="BiImagePreloader.html">BiImagePreloader</a></code></li><li style="display:none"><code><a href="BiMenu.html">BiMenu</a></code></li><li style="display:none"><code><a href="BiMenuItem.html">BiMenuItem</a></code></li><li style="display:none"><code><a href="BiRadioGroup.html">BiRadioGroup</a></code></li><li style="display:none"><code><a href="BiRangeModel.html">BiRangeModel</a></code></li><li style="display:none"><code><a href="BiResourceLoader.html">BiResourceLoader</a></code></li><li style="display:none"><code><a href="BiScriptLoaderQueue.html">BiScriptLoaderQueue</a></code></li><li style="display:none"><code><a href="BiSelectionModel.html">BiSelectionModel</a></code></li><li style="display:none"><code><a href="BiStringBundle.html">BiStringBundle</a></code></li><li style="display:none"><code><a href="BiTextLoader.html">BiTextLoader</a></code></li><li style="display:none"><code><a href="BiTimer.html">BiTimer</a></code></li><li style="display:none"><code><a href="BiTreeViewDataModel.html">BiTreeViewDataModel</a></code></li><li style="display:none"><code><a href="BiTreeViewStateManager.html">BiTreeViewStateManager</a></code></li></ul></li></ul>
</li>
</ul>
<h2>Constructor</h2>
<p><code>
new BiEventTarget()</code></p>
<h3>Parameters</h3>
<p>No parameters.</p>
<h2>Properties</h2>
<p>None.</p>
<h2>Methods</h2>
<table>
<thead>
<tr>
<td>Name</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="#addEventListener">addEventListener</a></code></td>
<td>
This method adds a function object to call when the event with
the given name is dispatched. In case an object is passed as the
third argument then that will be used as <code>this</code> and
the function will be treated as a method of that object.
</td>
</tr>
<tr>
<td><code><a href="#dispatchEvent">dispatchEvent</a></code></td>
<td>This method dispatches an event and all the listeners
will get notified in the same order that they were added.
This returns false if any of the listeners called
<code><a href="BiEvent.html#preventDefault">preventDefault()</a></code>
on the event object.</td>
</tr>
<tr>
<td><code><a href="#removeEventListener">removeEventListener</a></code></td>
<td>
This method removes a previously added event handler function. Note
that the same function and object hat was used when adding the listener
must be passed as the second and third argument.
</td>
</tr>
</tbody>
</table>
<h2>Events</h2>
<p>None.</p>
<h2>Static Methods</h2>
<p>None.</p>
<h2>Static Fields</h2>
<p>None.</p>
<h2>Remarks</h2>
<p>
<code>
function eventHandler(oEvent) { ... };<br>
eventTarget.addEventListener("eventtype", eventHandler);<br>
<br>
function SomeClass() {<br>
...<br>
someObject.addEventListener("eventtype", this.handleEvent, this);<br>
}<br>
</code><br>
The argument <code>oEvent</code> to the event handler is the same event object that was
created in the <code><a href="#dispatchEvent">dispatchEvent</a></code> above. Inside the event handler
function <code>this</code> will point to the object that dispatched the
event (unless a third argument was provided).
</p>
<h2>Method Details</h2>
<h3><a name="addEventListener"></a>addEventListener</h3>
<p>
This method adds a function object to call when the event with
the given name is dispatched. In case an object is passed as the
third argument then that will be used as <code>this</code> and
the function will be treated as a method of that object.
</p>
<h4>Syntax</h4>
<pre class="method-syntax">object.addEventListener(<span class="methodArgument">sType</span>, <span class="methodArgument">fHandler</span> [, <span class="methodArgument">oObject</span>])</pre>
<h4>Parameters</h4>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="optional-header">Optional</td>
<td>Default</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<tr>
<td><code>sType</code></td>
<td><code class="type">String</code></td>
<td class="optional-column"></td>
<td></td>
<td>The event type (name)</td>
</tr>
<tr>
<td><code>fHandler</code></td>
<td><code class="type">Function</code></td>
<td class="optional-column"></td>
<td></td>
<td>The function to call</td>
</tr>
<tr>
<td><code>oObject</code></td>
<td><code class="type">The object the function is a method of</code></td>
<td class="optional-column"><img src="check.png" alt="checked"></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h4>Return Type</h4>
<p><code class="type">void</code></p>
<h3><a name="dispatchEvent"></a>dispatchEvent</h3>
<p>This method dispatches an event and all the listeners
will get notified in the same order that they were added.
This returns false if any of the listeners called
<code><a href="BiEvent.html#preventDefault">preventDefault()</a></code>
on the event object.</p>
<h4>Syntax</h4>
<pre class="method-syntax">object.dispatchEvent(<span class="methodArgument">oEvent</span>)</pre>
<h4>Parameters</h4>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="optional-header">Optional</td>
<td>Default</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<tr>
<td><code>oEvent</code></td>
<td><code class="type"><code><a href="BiEvent.html">BiEvent</a></code></code></td>
<td class="optional-column"></td>
<td></td>
<td>The event object to use in the event</td>
</tr>
</tbody>
</table>
<h4>Return Type</h4>
<p><code class="type">Boolean</code></p>
<h3><a name="removeEventListener"></a>removeEventListener</h3>
<p>
This method removes a previously added event handler function. Note
that the same function and object hat was used when adding the listener
must be passed as the second and third argument.
</p>
<h4>Syntax</h4>
<pre class="method-syntax">object.removeEventListener(<span class="methodArgument">sType</span>, <span class="methodArgument">fHandler</span> [, <span class="methodArgument">oObject</span>])</pre>
<h4>Parameters</h4>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="optional-header">Optional</td>
<td>Default</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<tr>
<td><code>sType</code></td>
<td><code class="type">String</code></td>
<td class="optional-column"></td>
<td></td>
<td>The event type (name)</td>
</tr>
<tr>
<td><code>fHandler</code></td>
<td><code class="type">Function</code></td>
<td class="optional-column"></td>
<td></td>
<td>The function to call</td>
</tr>
<tr>
<td><code>oObject</code></td>
<td><code class="type">The object the function is a method of</code></td>
<td class="optional-column"><img src="check.png" alt="checked"></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h4>Return Type</h4>
<p><code class="type">void</code></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -