Methods

addCurrentToMenuItem(item)

Add the current class and attributes to a menu item.

Parameters:
NameTypeDescription
itemHTMLElement

The menu item to add the current class and attributes to.

Since
  • 4.0.2

buildCacheKey(prefix, paramKeys, params) → {string}

Build a cache key.

Parameters:
NameTypeDescription
prefixstring

The prefix for the cache key.

paramKeysArray

The keys of the parameters to build the cache key.

paramsobject

The parameters to build the cache key.

Since
  • 4.0.2
Returns:

The cache key.

Type: 
string

removeCurrentFromMenuItem(item)

Remove the current class and attributes from a menu item.

Parameters:
NameTypeDescription
itemHTMLElement

The menu item to remove the current class and attributes from.

Since
  • 4.0.2

useCache(initialState) → {object}

A hook to manage a cache.

Parameters:
NameTypeDescription
initialStateobject

The initial state of the cache.

Since
  • 4.0.2
Returns:

The cache state and actions.

Type: 
object

useId(defaultId) → {string}

Generates a unique ID if default ID is not provided.

Parameters:
NameTypeDescription
defaultIdstring

The default ID.

Since
  • 3.2.2
Returns:

The ID.

Type: 
string