Skip to main content

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

NameTypeOptionalDescription
cardsCardsNoReference 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

NameTypeOptionalDescription
cardCardNoReference to the card constructor.
activatedbooleanYesSpecifies 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

NameTypeOptionalDescription
namestringNoContains the name of the feature.
cardCardNoReference to the card instance.
activatedbooleanYesSpecifies 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

NameTypeOptionalDescription
namestringNoContains the name of the feature.
cardCardYesReference to the card constructor.
activatedbooleanYesSpecifies 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

NameTypeOptionalDescription
featureFeatureNoReference 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

NameTypeOptionalDescription
namestringNoContains 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

NameTypeOptionalDescription
namestringNoContains the name of the feature.
activatedbooleanYesSpecifies if the feature is initially activated. (default is true).

Return value

Returns a reference to the feature.