From: Alexander Ebert Date: Thu, 31 Mar 2016 17:38:39 +0000 (+0200) Subject: Added usage docs for `Core.inherit()` X-Git-Tag: 3.0.0_Beta_1~1986^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3696feff4cf003e2d8ed96ee177f09750ef8fab2;p=GitHub%2FWoltLab%2FWCF.git Added usage docs for `Core.inherit()` --- diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Core.js b/wcfsetup/install/files/js/WoltLab/WCF/Core.js index 294bcfa535..75e0580bc7 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Core.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Core.js @@ -117,6 +117,20 @@ define([], function() { * Inherits the prototype methods from one constructor to another * constructor. * + * Usage: + * + * function MyDerivedClass() {} + * Core.inherit(MyDerivedClass, TheAwesomeBaseClass, { + * // regular prototype for `MyDerivedClass` + * + * overwrittenMethodFromBaseClass: function(foo, bar) { + * // do stuff + * + * // invoke parent + * MyDerivedClass._super.prototype.overwrittenMethodFromBaseClass.call(this, foo, bar); + * } + * }); + * * @see https://github.com/nodejs/node/blob/7d14dd9b5e78faabb95d454a79faa513d0bbc2a5/lib/util.js#L697-L735 * @param {function} constructor inheriting constructor function * @param {function} superConstructor inherited constructor function