Methods
addCurrentToMenuItem(item)
Add the current class and attributes to a menu item.
Name | Type | Description |
---|---|---|
item | HTMLElement | The menu item to add the current class and attributes to. |
- Since
- 4.0.2
buildCacheKey(prefix, paramKeys, params) → {string}
Build a cache key.
Name | Type | Description |
---|---|---|
prefix | string | The prefix for the cache key. |
paramKeys | Array | The keys of the parameters to build the cache key. |
params | object | The parameters to build the cache key. |
- Since
- 4.0.2
- Source
The cache key.
- Type:
- string
getSearchParamsObjFromKeys(keys, searchParams) → {object}
Get a search params object from an array of keys and search params provided.
Name | Type | Description |
---|---|---|
keys | Array | | The keys to get from the search params. |
searchParams | URLSearchParams | The search params to get the keys from. |
- Since
- 4.0.2
The search params object.
- Type:
- object
hijackMenuClick(event)
Hijacks the click event on the menu.
Name | Type | Description |
---|---|---|
event | Event | The click event. |
- Since
- 4.0.2
removeCurrentFromMenuItem(item)
Remove the current class and attributes from a menu item.
Name | Type | Description |
---|---|---|
item | HTMLElement | The menu item to remove the current class and attributes from. |
- Since
- 4.0.2
useCache(initialState) → {object}
A hook to manage a cache.
Name | Type | Description |
---|---|---|
initialState | object | The initial state of the cache. |
- Since
- 4.0.2
- Source
The cache state and actions.
- Type:
- object
useHijackWpMenu(menuId, paramKeys, setSearchParams)
Hijacks the click event on the menu.
Name | Type | Description |
---|---|---|
menuId | string | The ID of the menu to hijack. |
paramKeys | Array | | The keys to get from the search params. |
setSearchParams | function | The function to set the search params. |
- Since
- 4.0.2
useId(defaultId) → {string}
Generates a unique ID if default ID is not provided.
Name | Type | Description |
---|---|---|
defaultId | string | The default ID. |
- Since
- 3.2.2
- Source
The ID.
- Type:
- string