Merge pull request #4380 from englercj/master

Correct jsdoc for Class utilities
This commit is contained in:
Richard Davey 2019-02-24 23:07:10 +00:00 committed by GitHub
commit dfb1e48f6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,6 +66,15 @@ function hasNonConfigurable (obj, k)
return false; return false;
} }
/**
* Extends the given `myClass` object's prototype with the properties of `definition`.
*
* @function Phaser.Class.extend
* @param {Object} ctor The constructor object to mix into.
* @param {Object} definition A dictionary of functions for the class.
* @param {boolean} isClassDescriptor Is the definition a class descriptor?
* @param {Object} [extend] The parent constructor object.
*/
function extend (ctor, definition, isClassDescriptor, extend) function extend (ctor, definition, isClassDescriptor, extend)
{ {
for (var k in definition) for (var k in definition)
@ -108,6 +117,13 @@ function extend (ctor, definition, isClassDescriptor, extend)
} }
} }
/**
* Applies the given `mixins` to the prototype of `myClass`.
*
* @function Phaser.Class.mixin
* @param {Object} myClass The constructor object to mix into.
* @param {Object|Array<Object>} mixins The mixins to apply to the constructor.
*/
function mixin (myClass, mixins) function mixin (myClass, mixins)
{ {
if (!mixins) if (!mixins)
@ -136,7 +152,7 @@ function mixin (myClass, mixins)
* You can also use `Extends` and `Mixins` to provide subclassing * You can also use `Extends` and `Mixins` to provide subclassing
* and inheritance. * and inheritance.
* *
* @class Class * @class Phaser.Class
* @constructor * @constructor
* @param {Object} definition a dictionary of functions for the class * @param {Object} definition a dictionary of functions for the class
* @example * @example