MenuStore | context-menu

### Hierarchy

- MenuStore

## Index

### Constructors

- constructor

### Properties

- active
- attachedClass
- attrMap
- counter
- menu
- store
- taborder

### Methods

- addEvent
- addEvents
- addTabindex
- clear
- getActive
- inTaborder
- insert
- insertElement
- insertTaborder
- insertTaborder_
- keydown
- next
- previous
- remove
- removeElement
- removeEvent
- removeEvents
- removeTabindex
- removeTaborder
- removeTaborder_
- setActive
- sort

## Constructors

### constructor

- new MenuStore(menu: ContextMenu): MenuStore

- - Defined in menu_store.ts:40
  constructor

  #### Parameters

  - ##### menu: ContextMenu

    The context menu the store belongs to.

  #### Returns MenuStore

## Properties

### Private active

active: HTMLElement = null

- Defined in menu_store.ts:34

### Private attachedClass

attachedClass: string = HtmlClasses['ATTACHED'] + '_' +MenuUtil.counter()

- Defined in menu_store.ts:37

### Private attrMap

attrMap: object

- Defined in menu_store.ts:40

#### Type declaration

- ##### [name: string]: EventListener

### Private counter

counter: number = 0

- Defined in menu_store.ts:36

### Private menu

menu: ContextMenu

- Defined in menu_store.ts:35

### Private store

store: HTMLElement[] = []

- Defined in menu_store.ts:33

### Private taborder

taborder: boolean = true

- Defined in menu_store.ts:39

## Methods

### Private addEvent

- addEvent(element: HTMLElement, name: string, func: EventListener): void

- - Defined in menu_store.ts:312

  Adds a single event listeners and stores them in the attribute mapping.

  #### Parameters

  - ##### element: HTMLElement

    The DOM element.

  - ##### name: string

    The name of the event handler.

  - ##### func: EventListener

    The event listener.

  #### Returns void

### Private addEvents

- addEvents(element: HTMLElement): void

- - Defined in menu_store.ts:296

  Adds event listeners to activate the context menu to an element.

  To be able to remove event listeners we have to remember exactly which listeners we have added. We safe them in the attribute mapping attrMap, as a combination of event handler name and counter, which is unique for each HTML element. The counter is stored on the HTML element in an attribute.

  #### Parameters

  - ##### element: HTMLElement

    The DOM element.

  #### Returns void

### Private addTabindex

- addTabindex(element: HTMLElement): void

- - Defined in menu_store.ts:262

  Adds tabindex to an element and possibly safes an existing one.

  #### Parameters

  - ##### element: HTMLElement

    The DOM element.

  #### Returns void

### clear

- clear(): void

- - Defined in menu_store.ts:111

  Removes all elements in the store.

  #### Returns void

### getActive

- getActive(): HTMLElement

- - Defined in menu_store.ts:67

  #### Returns HTMLElement

  The currently active store element, if one exists.

### inTaborder

- inTaborder(flag: boolean): void

- - Defined in menu_store.ts:177

  Sets if elements of the store are included in the taborder or not.

  #### Parameters

  - ##### flag: boolean

    If true elements are in taborder, o/w not.

  #### Returns void

### insert

- insert(element: HTMLElement): void
- insert(elements: HTMLElement[]): void
- insert(elements: NodeListOf<HTMLElement>): void

- - Defined in menu_store.ts:118

  Inserts DOM elements into the store.

  #### Parameters

  - ##### element: HTMLElement

    Single element to insert.

  #### Returns void

- - Defined in menu_store.ts:123

  Inserts DOM elements into the store.

  #### Parameters

  - ##### elements: HTMLElement[]

    List of elements to insert.

  #### Returns void

- - Defined in menu_store.ts:128

  Inserts DOM elements into the store.

  #### Parameters

  - ##### elements: NodeListOf<HTMLElement>

    List of elements to insert.

  #### Returns void

### Private insertElement

- insertElement(element: HTMLElement): void

- - Defined in menu_store.ts:209

  Adds a DOM element to the store.

  #### Parameters

  - ##### element: HTMLElement

    The DOM element.

  #### Returns void

### insertTaborder

- insertTaborder(): void

- - Defined in menu_store.ts:190

  Inserts all elements in the store into the tab order.

  #### Returns void

### Private insertTaborder_

- insertTaborder_(): void

- - Defined in menu_store.ts:247

  Inserts all elements in the store into the tab order.

  #### Returns void

### Private keydown

- keydown(event: KeyboardEvent): void

- - Defined in menu_store.ts:349

  Deals with key down keyboard events.

  #### Parameters

  - ##### event: KeyboardEvent

    The keyboard event.

  #### Returns void

### next

- next(): HTMLElement

- - Defined in menu_store.ts:77

  Returns next active element. If store is empty returns null and also unsets active element. If active is not set returns the first element of the store.

  #### Returns HTMLElement

  The next element if it exists.

### previous

- previous(): HTMLElement

- - Defined in menu_store.ts:95

  Returns previous active element. If store is empty returns null and also unsets active element. If active is not set returns the last element of the store.

  #### Returns HTMLElement

  The previous element if it exists.

### remove

- remove(element: HTMLElement): void
- remove(element: HTMLElement[]): void
- remove(element: NodeListOf<HTMLElement>): void

- - Defined in menu_store.ts:147

  Removes DOM elements from the store.

  #### Parameters

  - ##### element: HTMLElement

    Single element to remove.

  #### Returns void

- - Defined in menu_store.ts:152

  Removes DOM elements from the store.

  #### Parameters

  - ##### element: HTMLElement[]

  #### Returns void

- - Defined in menu_store.ts:157

  Removes DOM elements from the store.

  #### Parameters

  - ##### element: NodeListOf<HTMLElement>

  #### Returns void

### Private removeElement

- removeElement(element: HTMLElement): void

- - Defined in menu_store.ts:225

  Removes a DOM element from the store.

  #### Parameters

  - ##### element: HTMLElement

    The DOM element.

  #### Returns void

### Private removeEvent

- removeEvent(element: HTMLElement, name: string, counter: string): void

- - Defined in menu_store.ts:339

  Removes a single event listeners from an HTML element.

  #### Parameters

  - ##### element: HTMLElement

    The DOM element.

  - ##### name: string

    The name of the event handler.

  - ##### counter: string

    The unique counter to identify the handler in the attribute mappings.

  #### Returns void

### Private removeEvents

- removeEvents(element: HTMLElement): void

- - Defined in menu_store.ts:322

  Removes event listeners that activate the context menu from an element.

  #### Parameters

  - ##### element: HTMLElement

    The DOM element.

  #### Returns void

### Private removeTabindex

- removeTabindex(element: HTMLElement): void

- - Defined in menu_store.ts:274

  Removes tabindex from element or restores an old one.

  #### Parameters

  - ##### element: HTMLElement

    The DOM element.

  #### Returns void

### removeTaborder

- removeTaborder(): void

- - Defined in menu_store.ts:199

  Removes all elements in the store from the tab order.

  #### Returns void

### Private removeTaborder_

- removeTaborder_(): void

- - Defined in menu_store.ts:254

  Removes all elements in the store from the tab order.

  #### Returns void

### setActive

- setActive(element: HTMLElement): void

- - Defined in menu_store.ts:54

  Sets the new active store element if it exists in the store.

  #### Parameters

  - ##### element: HTMLElement

    Element to be activated.

  #### Returns void

### Private sort

- sort(): void

- - Defined in menu_store.ts:239

  Sorts the elements in the store in DOM order.

  #### Returns void

Generated using TypeDoc