Skip to main content

Class: SoftKeyEnumController<T>

Defined in: src/garminsdk/softkey/SoftKeyControllers.ts:78

A controller which binds a softkey to a state which can take one of several enumerated values. Once bound, the softkey will display the bound state and each press of the softkey will cycle the state through possible values.

Type Parameters

Type Parameter
T

Constructors

Constructor

new SoftKeyEnumController<T>(softkeyMenu, softkeyIndex, softkeyLabel, state, textMap, nextFunc): SoftKeyEnumController<T>

Defined in: src/garminsdk/softkey/SoftKeyControllers.ts:95

Constructor.

Parameters

ParameterTypeDescription
softkeyMenuSoftKeyMenuThe softkey menu to which this controller's softkey belongs.
softkeyIndexnumberThe index in the softkey menu at which this controller's softkey is located.
softkeyLabelstringThe text label of this controller's softkey.
stateMutableSubscribable<T>The state bound to this controller's softkey.
textMap(value) => stringA function which maps values to their text representations.
nextFunc(currentValue) => TA function which gets the next value given the current value.

Returns

SoftKeyEnumController<T>

Methods

destroy()

destroy(): void

Defined in: src/garminsdk/softkey/SoftKeyControllers.ts:131

Destroys this controller. This will remove the softkey menu item bound to this controller's state.

Returns

void


init()

init(): SoftKeyMenuItem

Defined in: src/garminsdk/softkey/SoftKeyControllers.ts:110

Initializes this controller. This will create a softkey menu item and bind it to this controller's state.

Returns

SoftKeyMenuItem

The softkey menu item bound to this controller's state.

Throws

Error if this controller has been destroyed.