1
0
Fork 0

Added missing trait docblocks

perfodd
Mike Gerwitz 2014-03-11 06:46:12 -04:00
parent eab4dbfe4d
commit bfadd9fce9
1 changed files with 28 additions and 0 deletions

View File

@ -23,6 +23,15 @@ var AbstractClass = require( __dirname + '/class_abstract' ),
ClassBuilder = require( __dirname + '/ClassBuilder' ); ClassBuilder = require( __dirname + '/ClassBuilder' );
/**
* Trait constructor / base object
*
* The interpretation of the argument list varies by number. Further,
* various trait methods may be used as an alternative to invoking this
* constructor.
*
* @return {Function} trait
*/
function Trait() function Trait()
{ {
switch ( arguments.length ) switch ( arguments.length )
@ -199,6 +208,18 @@ function _parseProps( name, value, keywords, h )
} }
/**
* Implement one or more interfaces
*
* Implementing an interface into a trait has the same effect as it does
* within classes in that it will automatically define abstract methods
* unless a concrete method is provided. Further, the class that the trait
* is mixed into will act as though it implemented the interfaces.
*
* @param {...Function} interfaces interfaces to implement
*
* @return {Object} staged trait object
*/
Trait.implement = function() Trait.implement = function()
{ {
var ifaces = arguments; var ifaces = arguments;
@ -216,6 +237,13 @@ Trait.implement = function()
}; };
/**
* Determines if the provided value references a trait
*
* @param {*} trait value to check
*
* @return {boolean} whether the provided value references a trait
*/
Trait.isTrait = function( trait ) Trait.isTrait = function( trait )
{ {
return !!( trait || {} ).__trait; return !!( trait || {} ).__trait;