Class Presto .Observable
A base class that supports publishing events to observer classes.
Constructor Attributes | Constructor Name and Description |
---|---|
Presto.Observable(events)
|
Method Attributes | Method Name and Description |
---|---|
addEvents(events)
Adds one or more named events for this observable. |
|
addListener(eventName, handler, scope)
Registers a listener for the specified event for an observer of this class. |
|
fireEvent(eventName)
Fires the specified event, notifying all listeners registered for this event. |
|
hasEvent(eventName)
Determines if the specified event exists on the current object and returns a boolean. |
|
removeListener(eventName, fn)
Removes the specified listener. |
Adds one or more named events for this observable.
- Parameters:
- {Object} events
- An object with event names to add to this observable.
Registers a listener for the specified event for an observer of this class.
- Parameters:
- {String} eventName
- The name of the event this listener is interested in.
- {Function} handler
- The oberver's handler function to notify for this type of event.
- {Object} scope
- The scope in which the handler should be called.
Fires the specified event, notifying all listeners registered for this event. Any additional parameters specified in this call are passed to listeners.
- Parameters:
- {String} eventName
- The name of the event to fire.
Determines if the specified event exists on the current object and returns a boolean.
- Parameters:
- {String} eventName
- The event name to check for.
Removes the specified listener.
- Parameters:
- {String} eventName
- The name of the event for this listener.
- {Function} fn
- The handler function for the listener to remove.