Namespace: mixwith

qui.base.mixwith

Utilities for writing mixins. Copied and adapted from Justin Fagnani's work: https://github.com/justinfagnani/mixwith.js.

Source:

Classes

MixinBuilder

Methods

(static) mix(superclassopt) → {MixinBuilder}

Apply a list of mixins to a superclass.

class X extends mix(Object).with(A, B, C) {}

The mixins are applied in order to the superclass, so the prototype chain will be: X->C'->B'->A'->Object.

This is purely a convenience function. The above example is equivalent to:

class X extends C(B(A(Object))) {}
Parameters:
Name Type Attributes Description
superclass Class.<Object> <optional>
Source:
Returns:
Type
MixinBuilder

(static) Mixin(mixin) → {qui.base.mixwith.MixinFunction}

Prepare a mixin function.

Parameters:
Name Type Description
mixin qui.base.mixwith.MixinFunction

the mixin function

Source:
Returns:

the prepared mixin function

Type
qui.base.mixwith.MixinFunction

Type Definitions

MixinFunction(superclass, rootclass, mixin)

A function that, when called with (applied to) a superclass, generates a new class inherited indirectly from the superclass and directly from an intermediate mixin dynamic class, offering extra functionality, specific to the mixin.

Parameters:
Name Type Description
superclass Class.<Object>

class to which the mixin will be applied

rootclass
mixin
Source: