Class Index | File Index

Classes


Class TKClass

The TKClass function will process a constructor function and set up its inheritance chain, synthetize a number of its instance properties and mix in additional capabilities based properties defined on that function. The supported properties are:

For instance, consider the following class declaration:

// extends MySuperClass
MyClass.inherits = MySuperClass;

// mixes in the TKEventTriage and TKPropertyTriage modules
MyClass.includes = [TKEventTriage, TKPropertyTriage]; 

// synthetizes the .foo and .bar properties
MyClass.synthetizes = ['foo', 'bar'];

function MyClass () {
  // constructor code goes here
};

// process properties set up on the MyClass constructor
TKClass(MyClass);
 

Synthetization is fully automated as long as the class that wishes to offer synthetized properties follows the following rules:

So our previous class declaration could be extended as follows:

function MyClass () {
  this._foo = '';
};

// custom setter for .foo, the getter is not specified
// and TKClass() will automatically create it
MyClass.prototype.setFoo = function (newFooValue) {
  this._foo = newFooValue;
};

// custom getter for .foo, the setter is not specified
// and TKClass() will automatically create it
MyClass.prototype.getBar = function (newFooValue) {
  return 'Hello ' + this._foo;
};
 

Defined in: Class.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
TKClass(theClass)
Class Detail
TKClass(theClass)
Parameters:
theClass
{Object} The class.
Since:
TuneKit 1.0

Copyright © 2009 Apple Inc. All rights reserved.