diff -r 000000000000 -r 40c8f766c9b8 src/cm/media/js/lib/yui/yui_3.0.0b1/api/EventTarget.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui_3.0.0b1/api/EventTarget.html Mon Nov 23 15:14:29 2009 +0100 @@ -0,0 +1,1100 @@ + + + + + API: event-custom EventTarget (YUI Library) + + + + + + + + + + +
+
+

Yahoo! UI Library

+

event-custom  3.0.0b1

+ Yahoo! UI Library + > event-custom + > EventTarget + +
+
+ Search: +
+   +
+
+
+
+ +
+
+
+
+
+ Filters + + + +
+
+ +

+ + + + + Class EventTarget + + + +

+ + +
+
Known Subclasses:
+
+ + AsyncQueue + +
+
+ + + +
+ EventTarget provides the implementation for any object to +publish, subscribe and fire to custom events, and also +alows other EventTargets to target the object with events +sourced from the other object. +EventTarget is designed to be used with Y.augment to wrap +EventCustom in an interface that allows events to be listened to +and fired by name. This makes it possible for implementing code to +subscribe to an event that either has not been created yet, or will +not be created at all. +
+ + +
+ +
+ +
+
+

Methods

+
+
+

+ _getType

+
+ + private + + + void + _getType + ( + ) + + +
+ If the instance has a prefix attribute and the +event type is not prefixed, the instance prefix is +applied to the supplied type. +
+ +
+ + +
+
Returns: + + void +
+
+
+ + + + +
+ +
+
+
+
+

+ _parseType

+
+ + private + + + void + _parseType + ( + ) + + +
+ Returns an array with the detach key (if provided), +and the prefixed event name from _getType +Y.on('detachcategory, menu:click', fn) +
+ +
+ + +
+
Returns: + + void +
+
+
+ + + + +
+ +
+
+
+
+

+ addTarget

+
+ + + + + void + addTarget + ( + + + o + + + ) + + +
+ Registers another EventTarget as a bubble target. Bubble order +is determined by the order registered. Multiple targets can +be specified. +
+ +
+ +
+
Parameters:
+
+ o + <EventTarget> + + the target to add +
+
+ +
+
Returns: + + void +
+
+
+ + + + +
+ +
+
+
+
+

+ after

+
+ + + + + + after + ( + + + type + + + , + fn + + + ) + + +
+ Subscribe to a custom event hosted by this object. The +supplied callback will execute after any listeners add +via the subscribe method, and after the default function, +if configured for the event, has executed. +
+ +
+ +
+
Parameters:
+
+ type + <string> + + The type of the event +
+
+ fn + <Function> + + The callback +
+
+ + + + + +
+ +
+
+
+
+

+ before

+
+ + + + + + before + ( + ) + + +
+ Executes the callback before a DOM event, custom event +or method. If the first argument is a function, it +is assumed the target is a method. For DOM and custom +events, this is an alias for Y.on. +For DOM and custom events: +type, callback, context, 1-n arguments +For methods: +callback, object (method host), methodName, context, 1-n arguments +
+ +
+ + + + + +
+ Deprecated use the on method +
+ +
+ +
+
+
+
+

+ bubble

+
+ + + + + boolean + bubble + ( + + + evt + + + ) + + +
+ Propagate an event +
+ +
+ +
+
Parameters:
+
+ evt + <Event.Custom> + + the custom event to propagate +
+
+ +
+
Returns: + + boolean +
+
the aggregated return value from Event.Custom.fire
+
+ + + + +
+ +
+
+
+
+

+ detach

+
+ + + + + EventTarget + detach + ( + + + type + + + , + fn + + + , + context + + + ) + + +
+ Detach one or more listeners the from the specified event +
+ +
+ +
+
Parameters:
+
+ type + <string|Object> + + Either the handle to the subscriber or the +type of event. If the type +is not specified, it will attempt to remove +the listener from all hosted events. +
+
+ fn + <Function> + + The subscribed function to unsubscribe, if not +supplied, all subscribers will be removed. +
+
+ context + <Object> + + The custom object passed to subscribe. This is +optional, but if supplied will be used to +disambiguate multiple listeners that are the same +(e.g., you subscribe many object using a function +that lives on the prototype) +
+
+ +
+
Returns: + + EventTarget +
+
the host
+
+ + + + +
+ +
+
+
+
+

+ detachAll

+
+ + + + + void + detachAll + ( + + + type + + + ) + + +
+ Removes all listeners from the specified event. If the event type +is not specified, all listeners from all hosted custom events will +be removed. +
+ +
+ +
+
Parameters:
+
+ type + <string> + + The type, or name of the event +
+
+ +
+
Returns: + + void +
+
+
+ + + + +
+ +
+
+
+
+

+ fire

+
+ + + + + boolean + fire + ( + + + type + + + , + arguments + + + ) + + +
+ Fire a custom event by name. The callback functions will be executed +from the context specified when the event was created, and with the +following parameters. +If the custom event object hasn't been created, then the event hasn't +been published and it has no subscribers. For performance sake, we +immediate exit in this case. This means the event won't bubble, so +if the intention is that a bubble target be notified, the event must +be published on this object first. +
+ +
+ +
+
Parameters:
+
+ type + <String|Object> + + The type of the event, or an object that contains +a 'type' property. +
+
+ arguments + <Object*> + + an arbitrary set of parameters to pass to +the handler. +
+
+ +
+
Returns: + + boolean +
+
the return value from Event.Custom.fire
+
+ + + + +
+ +
+
+
+
+

+ getEvent

+
+ + + + + Event.Custom + getEvent + ( + + + type + + + ) + + +
+ Returns the custom event of the provided type has been created, a +falsy value otherwise +
+ +
+ +
+
Parameters:
+
+ type + <string> + + the type, or name of the event +
+
+ +
+
Returns: + + Event.Custom +
+
the custom event or null
+
+ + + + +
+ +
+
+
+
+

+ on

+
+ + + + + + on + ( + + + type + + + , + fn + + + ) + + +
+ Subscribe to a custom event hosted by this object +
+ +
+ +
+
Parameters:
+
+ type + <string> + + The type of the event +
+
+ fn + <Function> + + The callback +
+
+ + + + + +
+ +
+
+
+
+

+ publish

+
+ + + + + Event.Custom + publish + ( + + + type + + + , + opts + + + ) + + +
+ Creates a new custom event of the specified type. If a custom event +by that name already exists, it will not be re-created. In either +case the custom event is returned. +
+ +
+ +
+
Parameters:
+
+ type + <string> + + the type, or name of the event +
+
+ opts + <object> + + optional config params. Valid properties are: +
    +
  • +'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false) +
  • +
  • +'bubbles': whether or not this event bubbles (true) +
  • +
  • +'context': the default execution context for the listeners (this) +
  • +
  • +'defaultFn': the default function to execute when this event fires if preventDefault was not called +
  • +
  • +'emitFacade': whether or not this event emits a facade (false) +
  • +
  • +'prefix': the prefix for this targets events, e.g., 'menu' in 'menu:click' +
  • +
  • +'fireOnce': if an event is configured to fire once, new subscribers after +the fire will be notified immediately. +
  • +
  • +'preventable': whether or not preventDefault() has an effect (true) +
  • +
  • +'preventedFn': a function that is executed when preventDefault is called +
  • +
  • +'queuable': whether or not this event can be queued during bubbling (false) +
  • +
  • +'silent': if silent is true, debug messages are not provided for this event. +
  • +
  • +'stoppedFn': a function that is executed when stopPropagation is called +
  • +
  • +'type': the event type (valid option if not provided as the first parameter to publish) +
  • +
+
+
+ +
+
Returns: + + Event.Custom +
+
the custom event
+
+ + + + +
+ +
+
+
+
+

+ removeTarget

+
+ + + + + void + removeTarget + ( + + + o + + + ) + + +
+ Removes a bubble target +
+ +
+ +
+
Parameters:
+
+ o + <EventTarget> + + the target to remove +
+
+ +
+
Returns: + + void +
+
+
+ + + + +
+ +
+
+
+
+

+ subscribe

+
+ + + + + void + subscribe + ( + ) + + +
+ subscribe to an event +
+ +
+ + +
+
Returns: + + void +
+
+
+ + + +
+ Deprecated use on +
+ +
+ +
+
+
+
+

+ unsubscribe

+
+ + + + + void + unsubscribe + ( + ) + + +
+ detach a listener +
+ +
+ + +
+
Returns: + + void +
+
+
+ + + +
+ Deprecated use detach +
+ +
+ +
+
+
+
+

+ unsubscribeAll

+
+ + + + + void + unsubscribeAll + ( + + + type + + + ) + + +
+ Removes all listeners from the specified event. If the event type +is not specified, all listeners from all hosted custom events will +be removed. +
+ +
+ +
+
Parameters:
+
+ type + <string> + + The type, or name of the event +
+
+ +
+
Returns: + + void +
+
+
+ + + +
+ Deprecated use detachAll +
+ +
+ +
+
+
+
+
+ +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+
+
+ Copyright © 2009 Yahoo! Inc. All rights reserved. +
+
+ + +