Patrons
❤️ theCodeCampus - Trainings for Angular and TypeScript
Download the NPM package
npm i --save @w11k/ts-mixins
Usage
How to use mixins together with a base class:
class BaseClass {
baseClassMethod() {
return 0;
}
}
class Mixin1 {
mixin1Method() {
return 1;
}
}
class Mixin2 {
mixin2Method() {
return 2;
}
}
class Sub extends withBaseClassAndMixins(BaseClass, Mixin1) {
}
How to use mixins without a base class:
class Mixin1 {
mixin1Method() {
return 1;
}
}
class Mixin2 {
mixin2Method() {
return 2;
}
}
class Sub extends withMixins(BaseClass, Mixin1) {
}