Event.Target.html revision 4fcbec6145d16637205990699912fb90f6a3807c
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico <title>API: event Event.Target (YUI Library)</title>
d048f1c15089c16b8ca1b264513a2f92ff86e703JazzyNico <link rel="stylesheet" type="text/css" href="assets/api.css">
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico <script type="text/javascript" src="assets/api-js"></script>
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico <script type="text/javascript" src="assets/ac-js"></script>
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico <a href="http://developer.yahoo.com/yui/"><h1>Yahoo! UI Library</h1></a>
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico <h3>event <span class="subtitle">3.00PR1</span></h3>
037bf91e68f10e796fecad5054b332b003c3a562JazzyNico <span id="classopts"><input type="checkbox" name="showprivate" id="showprivate" /> <label for="showprivate">Show Private</label></span>
037bf91e68f10e796fecad5054b332b003c3a562JazzyNico <span id="classopts"><input type="checkbox" name="showprotected" id="showprotected" /> <label for="showprotected">Show Protected</label></span>
037bf91e68f10e796fecad5054b332b003c3a562JazzyNico <span id="classopts"><input type="checkbox" name="showdeprecated" id="showdeprecated" /> <label for="showdeprecated">Show Deprecated</label></span>
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico <!-- class tree goes here -->
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico Event.Target is designed to be used with Y.augment to wrap
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNicoEvent.Custom in an interface that allows events to be subscribed to
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNicoand fired by name. This makes it possible for implementing code to
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNicosubscribe to an event that either has not been created yet, or will
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNiconot be created at all.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico Registers another Event.Target as a bubble target. Bubble order
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNicois determined by the order registered. Multiple targets can
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNicobe specified.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico the target to add
037bf91e68f10e796fecad5054b332b003c3a562JazzyNico <dt>Returns:
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico Subscribe to a custom event hosted by this object. The
037bf91e68f10e796fecad5054b332b003c3a562JazzyNicosupplied callback will execute after any listeners add
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNicovia the subscribe method, and after the default function,
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNicoif configured for the event, has executed.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico The type of the event
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico The callback
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico The execution context
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico 1..n params to supply to the callback
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico <dt>Returns:
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico Propagate an event
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico the custom event to propagate
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico <dt>Returns:
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico <dd>the aggregated return value from Event.Custom.fire</dd>
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico Fire a custom event by name. The callback functions will be executed
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNicofrom the context specified when the event was created, and with the
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNicofollowing parameters.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNicoIf the custom event object hasn't been created, then the event hasn't
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNicobeen published and it has no subscribers. For performance sake, we
037bf91e68f10e796fecad5054b332b003c3a562JazzyNicoimmediate exit in this case. This means the event won't bubble, so
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNicoif the intention is that a bubble target be notified, the event must
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNicobe published on this object first.
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico The type of the event, or an object that contains
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNicoa 'type' property.
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico an arbitrary set of parameters to pass to
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico <dt>Returns:
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico Returns the custom event of the provided type has been created, a
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNicofalsy value otherwise
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico the type, or name of the event
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico <dt>Returns:
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico Creates a new custom event of the specified type. If a custom event
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNicoby that name already exists, it will not be re-created. In either
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNicocase the custom event is returned.
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico the type, or name of the event
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico optional config params. Valid properties are:
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false)
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico'bubbles': whether or not this event bubbles (true)
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico'context': the default execution context for the listeners (this)
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico'defaultFn': the default function to execute when this event fires if preventDefault was not called
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico'emitFacade': whether or not this event emits a facade (false)
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico'fireOnce': if an event is configured to fire once, new subscribers after
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNicothe fire will be notified immediately.
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico'preventable': whether or not preventDefault() has an effect (true)
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico'preventedFn': a function that is executed when preventDefault is called
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico'queuable': whether or not this event can be queued during bubbling (false)
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico'silent': if silent is true, debug messages are not provided for this event.
037bf91e68f10e796fecad5054b332b003c3a562JazzyNico'stoppedFn': a function that is executed when stopPropagation is called
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico'type': the event type (valid option if not provided as the first parameter to publish)
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico <dt>Returns:
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico Subscribes to the yui:load event, which fires when a Y.use operation
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico the function to execute
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico Optional execution context
03a66cd4de660bda047af143016e23dbcbbc9b1aJazzyNico 0..n Additional arguments to append
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNicoto the signature provided when the event fires.
037bf91e68f10e796fecad5054b332b003c3a562JazzyNico <dt>Returns:
d048f1c15089c16b8ca1b264513a2f92ff86e703JazzyNico <a name="method_removeTarget">removeTarget</a></h4>
1..n params to supply to the callback
(e.g., you subscribe many object using a function