/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.

Parameters:
NameTypeDescription
keystring

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.

Parameters:
NameTypeDescription
keystring

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.

Parameters:
NameTypeDescription
keystring

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.

Parameters:
NameTypeDescription
_hooksObject

A params object to be assigned to the hooks.current.