Replacer
Version 2.x
Replacer
is a simple base class, which is very similar to Mixer. The difference is that it is used to override only existing properties, it doesn’t add new properties to instance.
It is defined in dcl/bases/Replacer.js
.
Description
Here is its definition:
1 2 3 4 5 6 7 8 9 10 11 |
|
As you can see it overrides existing properties with non-default values. All other properties are ignored. It is a “tame” version of Mixer, which can be used to keep instances clean of unwanted properties. Replacer
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 40 41 |
|