Features class
📖 Description
The Features
class holds a collection of features that can be activated or deactivated. Features are implemented using the Feature
class. Each feature can control a single Card
.
🆕 constructor
Creates a new Features
instance.
Signature
constructor(cards: Cards): Features
Parameters
Name | Type | Optional | Description |
---|---|---|---|
cards | Cards | No | Reference to the cards collection. |
Return value
Returns a reference to the new Features
instance.
🗃️ Fields
🏷️ cards
Retrieves a reference to the cards collection.
Type
Cards
🏷️ isVisible
Sets or retrieves the features visibility.
Type
boolean
▶️ Methods
🔧 card
Adds a card with an invisible feature.
Signature
card(card: Card, activated?: boolean): Feature
Parameters
Name | Type | Optional | Description |
---|---|---|---|
card | Card | No | Reference to the card constructor. |
activated | boolean | Yes | Specifies if the card is activated (default is true ). |
Return value
Returns a reference to the feature.
🔧 destroy
Destroys the features.
Signature
destroy(): void
🔧 feature
Adds a feature card to the collection.
Signature
feature(name: string, card: Card, activated?: boolean): Feature
Parameters
Name | Type | Optional | Description |
---|---|---|---|
name | string | No | Contains the name of the feature. |
card | Card | No | Reference to the card instance. |
activated | boolean | Yes | Specifies if the feature is initially activated. (default is true ). |
Return value
Returns a reference to the feature.
🔧 option
Adds an option feature card to the list.
Signature
option(name: string, card?: Card, activated?: boolean): Feature
Parameters
Name | Type | Optional | Description |
---|---|---|---|
name | string | No | Contains the name of the feature. |
card | Card | Yes | Reference to the card constructor. |
activated | boolean | Yes | Specifies if the feature is initially activated. (default is true ). |
Return value
Returns a reference to the feature.
🔧 scrollIntoView
Scrolls a feature into view.
Signature
scrollIntoView(feature: Feature): void
Parameters
Name | Type | Optional | Description |
---|---|---|---|
feature | Feature | No | Reference to the the feature to scroll into view. |
🔧 scrollToTopOrBottom
Scrolls to the top if the scroll position is not at the top or scrolls to the bottom if the list is at the top.
Signature
scrollToTopOrBottom(): void
🔧 static
Adds a static feature to the feature list.
Signature
static(name: string): Feature
Parameters
Name | Type | Optional | Description |
---|---|---|---|
name | string | No | Contains the name of the feature. |
Return value
Returns a reference to the feature.
🔧 toggle
Adds a toggle to the feature list.
Signature
toggle(name: string, activated?: boolean): Feature
Parameters
Name | Type | Optional | Description |
---|---|---|---|
name | string | No | Contains the name of the feature. |
activated | boolean | Yes | Specifies if the feature is initially activated. (default is true ). |
Return value
Returns a reference to the feature.