Mixer
Version 1.x
Mixer
is a simple base class that mixes properties from its only argument
directly on its instance. It can be used to add new properties, or override
existing properties on an instance including methods. Mixer
is very simple
yet extremely powerful, when used correctly.
It can be included with following commands:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Description
Here is its definition:
1 2 3 4 5 6 |
|
As you can see that in a nutshell it is a one-liner that uses
dcl.mix() to do the work. Mixer
can be used
as a base, or as a mixin, but usually it serves as the most deepest
base to take care of parameters.
Refer to Best practices for constructors for discussion on constructor’ signatures.
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|