Class Index | File Index

Classes


Class TKObject

The TKObject class is the base class for all TuneKit objects and provides a way to receive and trigger notifications when a JavaScript property changes.

Observing a property on an object is done through the addPropertyObserver method, specifying the property to observe as well as the object that will receive the notifications of the property change. Likewise, an object can stop observing such changes using the removePropertyObserver method. When a property value changes, the author needs to call the notifyPropertyChange method so that registered observers will be notified. Note that synthetized properties will automatically trigger notifications when changed, so in this case, setters need not manually call notifyPropertyChange.

Finally, TKObject also provides the callSuper method to call the superclass's implementation of an overload method.


Defined in: Object.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
 
addPropertyObserver(propertyName, observer, methodName)
Adds an observer for the named property on this object.
 
callMethodNameAfterDelay(methodName, delay)
Calls a method on this object after a delay, allowing any number of optional extra arguments to be passed after the first two mandatory ones.
 
This method calls the object's superclass implementation of the current method
 
notifyPropertyChange(propertyName)
Triggers a notification that the given property on this object has changed.
 
removePropertyObserver(propertyName, observer)
Removes the observer for the named property on this object.
Class Detail
TKObject()
Since:
TuneKit 1.0
Method Detail
addPropertyObserver(propertyName, observer, methodName)
Adds an observer for the named property on this object. In case an existing combination of the observer and property is already registered, this method is a no-op.
Parameters:
{String} propertyName
The property to observe.
{Object} observer
The object that will be notified when the property is changed.
{String} methodName
The optional method name that will be called on the observer when the property is changed. If this property is not provided, the observer must implement the TKPropertyValueChange protocol.

{int} callMethodNameAfterDelay(methodName, delay)
Calls a method on this object after a delay, allowing any number of optional extra arguments to be passed after the first two mandatory ones.
Parameters:
{String} methodName
The method name to be called.
{int} delay
The delay in miliseconds.
Returns:
{int} The timeout that can be used to call clearTimeout.

callSuper()
This method calls the object's superclass implementation of the current method

notifyPropertyChange(propertyName)
Triggers a notification that the given property on this object has changed. For synthesized properties, this is called automatically upon setting the property. For methods that update an instance variable that is not synthesized, notifyPropertyChange has to be called manually so that observers are notified.
Parameters:
{String} propertyName
The observed property.

{bool} removePropertyObserver(propertyName, observer)
Removes the observer for the named property on this object. In case an existing combination of the observer and property is not already registered, this method is a no-op.
Parameters:
{String} propertyName
The observed property.
{Object} observer
The object that was notified when the property changed.
Returns:
{bool} Whether an observer was removed

Copyright © 2009 Apple Inc. All rights reserved.