/hooks
The mapp.hooks{} module parses, updates, and stores URL parameter.
{
current: {
layers: [],
locations: [],
},
set,
parse,
remove,
removeAll,
push,
filter,
}
Methods
(inner) filter(key, val)
Filter [remove] a value from an hooks.current array property.
This is requiired to strip a location.hook from the [selected] locations.
Name | Type | Description |
---|---|---|
key | string | hooks.current{} array property key. |
val | * | hooks.current[key] array property val. |
(inner) parse()
The method parses key/value pairs of URL searchParams from the document window.location.href.
(inner) push(key, val)
Assigns the val param to the hooks.current[key] property.
Name | Type | Description |
---|---|---|
key | string | hooks.current{} property key. |
val | * | hooks.current[key] property val. |
(inner) pushState()
Pushes changes in the hooks.current to the window URL.
(inner) remove(key)
Remove key from mapp.hooks.current and URI. Array properties will be emptied. Other properties will be deleted.
Name | Type | Description |
---|---|---|
key | string | hooks.current{} property key. |
(inner) removeAll()
Iterate through all hooks.current property keys and call the remove method with the key argument.
(inner) set(_hooks)
The set method will assign a URL params object to the hooks.current{} before calling the pushState() method.
Name | Type | Description |
---|---|---|
_hooks | Object | A params object to be assigned to the hooks.current. |