Added usage docs for `Core.inherit()`
authorAlexander Ebert <ebert@woltlab.com>
Thu, 31 Mar 2016 17:38:39 +0000 (19:38 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 31 Mar 2016 17:38:39 +0000 (19:38 +0200)
wcfsetup/install/files/js/WoltLab/WCF/Core.js

index 294bcfa5352e56d8063bc77624550991567c9354..75e0580bc79caeefae99e08090740363d19fd2d7 100644 (file)
@@ -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