| Package: | Ext.util |
| Class: | ClickRepeater |
| Extends: | Observable |
| Defined In: | ClickRepeater.js |
| Method | Defined By | |
|---|---|---|
ClickRepeater(String/HTMLElement/Element el, Object config) |
ClickRepeater | |
addEvents(Object object) : void |
Observable | |
| Copies any events from the passed object onto this object if they do not already exist. The passed object must also ... | ||
addListener(String eventName, Function handler, [Object scope], [Object options]) : void |
Observable | |
| Appends an event handler to this component | ||
fireEvent(String eventName, Object... args) : Boolean |
Observable | |
| Fires the specified event with the passed parameters (minus the event name). | ||
hasListener(String eventName) : Boolean |
Observable | |
| Checks to see if this object is currently listening for a specified event | ||
on(String eventName, Function handler, [Object options]) : void |
Observable | |
| Appends an event handler to this element (shorthand for addListener) | ||
| purgeListeners() : void | Observable | |
| Removes all listeners for this object | ||
removeListener(String eventName, Function handler, [Object scope]) : void |
Observable | |
| Removes a listener | ||
un(String eventName, Function handler, [Object scope]) : void |
Observable | |
| Removes a listener (shorthand for removeListener) | ||
| Event | Defined By | |
|---|---|---|
click : (Ext.util.ClickRepeater this) |
ClickRepeater | |
| Fires on a specified interval during the time the element is pressed. | ||
mousedown : (Ext.util.ClickRepeater this) |
ClickRepeater | |
| Fires when the mouse button is depressed. | ||
mouseup : (Ext.util.ClickRepeater this) |
ClickRepeater | |
| Fires when the mouse key is released. | ||
| Config Options | Defined By | |
|---|---|---|
| accelerate : Boolean | ClickRepeater | |
| True if autorepeating should start slowly and accelerate. "interval" and "delay" are ignored. "immediate" is honored. | ||
| delay : Number | ClickRepeater | |
| The initial delay before the repeating event begins firing. Similar to an autorepeat key delay. | ||
| el : String/HTMLElement/Element | ClickRepeater | |
| The element to act as a button. | ||
| interval : Number | ClickRepeater | |
| The interval between firings of the "click" event. Default 10 ms. | ||
| pressClass : String | ClickRepeater | |
| A CSS class name to be applied to the element while pressed. | ||
| preventDefault : Boolean | ClickRepeater | |
| True to prevent the default click event | ||
| stopDefault : Boolean | ClickRepeater | |
| True to stop the default click event | ||
public function ClickRepeater(String/HTMLElement/Element el, Object config)
el : String/HTMLElement/Elementconfig : Objectpublic function addEvents(Object object)
object : Objectvoidpublic function addListener(String eventName, Function handler, [Object scope], [Object options])
eventName : Stringhandler : Functionscope : Objectoptions : Object Combining Options
Using the options argument, it is possible to combine different types of listeners:
A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)
el.on('click', this.onClick, this, { single: true, delay: 100, stopEvent : true, forumId: 4 }); The method also allows for a single argument to be passed which is a config object containing properties which specify multiple handlers.
Attaching multiple handlers in 1 call
Code:
el.on({ 'click' : { fn: this.onClick scope: this, delay: 100 }, 'mouseover' : { fn: this.onMouseOver scope: this }, 'mouseout' : { fn: this.onMouseOut scope: this } }); Or a shorthand syntax:
Code:
el.on({ 'click' : this.onClick, 'mouseover' : this.onMouseOver, 'mouseout' : this.onMouseOut scope: this });voidpublic function fireEvent(String eventName, Object... args)
eventName : Stringargs : Object...Booleanpublic function hasListener(String eventName)
eventName : StringBooleanpublic function on(String eventName, Function handler, [Object options])
eventName : Stringhandler : Functionoptions : Objectvoidpublic function purgeListeners()
voidpublic function removeListener(String eventName, Function handler, [Object scope])
eventName : Stringhandler : Functionscope : Objectvoidpublic function un(String eventName, Function handler, [Object scope])
eventName : Stringhandler : Functionscope : Objectvoidpublic event click
this : Ext.util.ClickRepeaterpublic event mousedown
this : Ext.util.ClickRepeaterpublic event mouseup
this : Ext.util.ClickRepeateraccelerate : Boolean
delay : Number
el : String/HTMLElement/Element
interval : Number
pressClass : String
preventDefault : Boolean
stopDefault : Boolean