Class TKClass

Object
   |
   +--TKClass

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


Constructor Summary
TKClass(theClass)
            Copyright © 2009 Apple Inc.
 
Method Summary
<static> void mixin(target, sources)
          
<static> void synthetizeProperty(object, propertyName, isPropertyInherited)
          

Constructor Detail

TKClass

TKClass(theClass)

Method Detail

mixin

<static> void mixin(target, sources)

synthetizeProperty

<static> void synthetizeProperty(object, propertyName, isPropertyInherited)


Documentation generated by JSDoc on Tue Sep 15 21:24:36 2009