Event.Target
EventTarget provides the implementation for any object to publish, subscribe and fire to custom events, and also allows other EventTargets to target the object with events sourced from the other object. EventTarget is designed to be used with S.augment to allow 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.
defined in: target.js
Namespace
Methods
- Event.Target. addTarget (target) <static> Registers another EventTarget as a bubble target.
- Event.Target. detach (type, fn, scope) <static> Detach one or more listeners the from the specified event
- Event.Target. fire (type, eventData) <static> Fire a custom event by name.
- Event.Target. on (type, fn, scope) <static> Subscribe a callback function to a custom event fired by this object or from an object that bubbles its events to this object.
- Event.Target. publish (type, cfg) <static> Creates a new custom event of the specified type
- Event.Target. removeTarget (target) <static> Removes a bubble target
Namespace Detail
-
Event.TargetEventTarget provides the implementation for any object to publish, subscribe and fire to custom events, and also allows other EventTargets to target the object with events sourced from the other object. EventTarget is designed to be used with S.augment to allow 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 Detail
-
Registers another EventTarget as a bubble target.
- Parameters
-
- target {Event.Target} Another EventTarget instance to add
-
Detach one or more listeners the from the specified event
- Parameters
-
- type {String} The name of the event
- [ fn ] {Function} The subscribed function to unsubscribe. if not supplied, all subscribers will be removed.
- [ scope ] {Object} The custom object passed to subscribe.
-
Fire a custom event by name. The callback functions will be executed from the context specified when the event was created, and the Event.Object created will be mixed with eventData
- Parameters
-
- type {String} The type of the event
- [ eventData ] {Object} The data will be mixed with Event.Object created
- Returns
-
- {Boolean|*} If any listen returns false, then the returned value is false. else return the last listener's returned value
-
Subscribe a callback function to a custom event fired by this object or from an object that bubbles its events to this object.
- Parameters
-
- type {String} The name of the event
- fn {Function} The callback to execute in response to the event
- [ scope ] {Object} this object in callback
-
Creates a new custom event of the specified type
- Parameters
-
- type {String} The type of the event
- cfg {Object} Config params
- [ cfg.bubbles = false ] {Boolean} whether or not this event bubbles
-
Removes a bubble target
- Parameters
-
- target {Event.Target} Another EventTarget instance to remove
Classes
- Anim
- Anim.Easing
- Attribute
- Base
- Button
- ComboBox
- ComboBox.LocalDataSource
- ComboBox.RemoteDataSource
- Component
- Component.Container
- Component.Controller
- Component.Manager
- Component.Render
- Component.UIBase
- Component.UIBase.Align
- Component.UIBase.Box
- Component.UIBase.Close
- Component.UIBase.Constrain
- Component.UIBase.ContentBox
- Component.UIBase.Drag
- Component.UIBase.Loading
- Component.UIBase.Mask
- Component.UIBase.Position
- Component.UIBase.Resize
- Component.UIBase.StdMod
- Cookie
- DataLazyload
- DD
- DD.Constrain
- DD.DDM
- DD.Draggable
- DD.DraggableDelegate
- DD.Droppable
- DD.DroppableDelegate
- DD.Proxy
- DD.Scroll
- DOM
- Editor
- Editor.Range
- Editor.Utils
- Editor.Walker
- Event
- Event.Object
- Event.Target
- IO
- IO.XhrObject
- KISSY
- KISSY.Defer
- KISSY.Loader
- KISSY.Loader.Module
- KISSY.Loader.Package
- KISSY.Promise
- Menu
- Menu.FilterMenu
- Menu.Item
- Menu.PopupMenu
- Menu.Separator
- MenuButton
- MenuButton.Option
- MenuButton.Select
- MVC
- MVC.Collection
- MVC.Model
- MVC.Router
- MVC.View
- NodeList
- Overlay
- Overlay.Dialog
- Overlay.Popup
- Resizable
- Tree
- Tree.CheckNode
- Tree.CheckTree
- Tree.Node
- Waterfall
- Waterfall.Loader