Skip to content

Commit

Permalink
docs: add comment clarifying initFunction combining
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerntannern committed Apr 23, 2020
1 parent dafc33f commit 5df85c2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mixins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ function Mixin<
function Mixin(...constructors: Class[]) {
const prototypes = constructors.map(constructor => constructor.prototype);

// Here we gather up the init functions of the ingredient prototypes, combine them into one init function, and
// attach it to the mixed class prototype. The reason we do this is because we want the init functions to mix
// similarly to constructors -- not methods, which simply override each other.
const initFunctionName = settings.initFunction;
if (initFunctionName !== null) {
const initFunctions: Function[] = prototypes
Expand Down

0 comments on commit 5df85c2

Please sign in to comment.