bieventtarget.xml
来自「ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.」· XML 代码 · 共 135 行
XML
135 行
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="api.xsl"?><class name="BiEventTarget" extends="BiObject"> <description>This class provides the functionality to add and remove event listeners as well as dispatch events. When an event is dispatched the listeners are notified.</description> <arguments> </arguments> <staticMethods> </staticMethods> <staticFields> </staticFields> <methods> <method name="addEventListener"> <description>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.</description> <arguments> <argument name="sType"> <description>The event type (name)</description> <type>String</type> </argument> <argument name="fHandler"> <description>The function to call</description> <type>Function</type> </argument> <argument name="oObject" optional="true"> <description>Optional object that the function is a method of. This is used to map <code>this</code> in the function handling the event</description> <type>Object</type> </argument> </arguments> <returns> <type>void</type> </returns> </method> <method name="removeEventListener"> <description>This method removes a previously added event handler function. Note that the same function and object that was used when adding the listener must be passed as the second and third argument.</description> <arguments> <argument name="sType"> <description>The event type (name)</description> <type>String</type> </argument> <argument name="fHandler"> <description>The function/handler to remove</description> <type>Function</type> </argument> <argument name="oObject" optional="true"> <description>Optional object that the function is a method of.</description> <type>Object</type> </argument> </arguments> <returns> <type>void</type> </returns> </method> <method name="dispatchEvent"> <description>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 <link class="BiEvent" field="preventDefault">preventDefault()</link> on the event object.</description> <arguments> <argument name="oEvent"> <description>The event object to use in the event</description> <type> <link class="BiEvent">BiEvent</link> </type> </argument> </arguments> <returns> <type>Boolean</type> </returns> </method> <method name="setAttribute"> <description>This overrides the method to map attributes that starts with 'on' to event listeners. For example calling <code>setAttribute("onclick", "alert(event)")</code> will add a click listener with <code>function (event) { alert(event) }</code> as the handler function.</description> <arguments> <argument name="sName"> <description>The attribute name</description> <type>String</type> </argument> <argument name="sValue"> <description>The attribute value</description> <type>String</type> </argument> <argument name="oParser" optional="true"> <description>Optional parser that was used to read an XML file</description> <type> <link class="BiXmlResourceParser">BiXmlResourceParser</link> </type> </argument> </arguments> <returns> <type>void</type> </returns> </method> </methods> <properties> </properties> <events> </events> <remarks> <code> function eventHandler(oEvent) { ... };<br> </br> eventTarget.addEventListener("eventtype", eventHandler);<br> </br> <br> </br> function SomeClass() {<br> </br> ...<br> </br> someObject.addEventListener("eventtype", this.handleEvent, this);<br> </br> }<br> </br> </code> <br> </br> The argument <code>oEvent</code> to the event handler is the same event object that was created in the <link>dispatchEvent</link> above. Inside the event handler function <code>this</code> will point to the object that dispatched the event (unless a third argument was provided).</remarks></class>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?