Featureable
Mixin
internal
This mixin provides management of a set of features that can be manipulated via the features config.
The first step in using Featureable is to define the family of features using Factoryable to declare a base class for features to extend:
class SuperWidgetFeature extends InstancePlugin.mixin(Factoryable) {
static get factoryable() {
//
}
}
The various feature classes extend the SuperWidgetFeature base class and call initClass() to register themselves:
export default class AmazingSuperWidgetFeature extends SuperWidgetFeature {
static get type() {
return 'amazing';
}
}
AmazingSuperWidgetFeature.initClass();
A class that supports these features via Featureable is declared like so:
class SuperWidget extends Widget.mixin(Featureable) {
static get featureable() {
return {
factory : SuperWidgetFeature
};
}
static configurable = {
// Declare the default features. These can be disabled by setting them to a falsy value. Using
// configurable(), the value defined by this class is merged with values defined by derived classes
// and ultimately the instance.
features : {
amazing : {
...
}
}
};
}
No results
Configs
Configs are options you supply in a configuration object when creating an instance of this classProperties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of Featureable class, or subclass thereof.
-
Identifies an object as an instance of Featureable class, or subclass thereof.