popover

Popover service to keep state of opened popover. Allowing user to hide certain or all popovers

Parameters:
Name Type Description
popoverList Array

The popover that's currently being shown

registered Array

Object storing all the registered popover DOM elements

last function

Get data of the last popover

  • Returns {Object} The last opened popover
register function

Register a popover with an id and an element

  • {String} id Popover id
  • {Element} element Popover element
  • Returns {Bool} If the id already existed
unregister function

Remove id and element from registered list of popover

  • {String} id Popover id
  • Returns {Bool} If the id exist
add function

Add a new popover to opened list

  • {String} id Popover id
  • {Element} popover Popover DOM element
  • {Element} element Trigger DOM element
  • {Object} options Additional options
  • Returns {Object} The new popover object
pop function

Get and remove the last popover from list

  • Returns {Object} Last element from popoverList
show function

Show and position a registered popover

  • {String} id Popover id
  • {Element} element Element that trigger the popover
  • {Object} options Additional options for popover
  • Returns {Promise.}
getById function

Get opened popover object by id

  • {String} id Popover id
  • Returns {Object} Opened popover object
reposition function

Update size and position of an opened popover

  • {Object|String} popoverObj Support multiple type input:
    • Object: One of the popover objects in popoverList
    • String: Popover ID
  • Returns {Promise.}
hide function

Hide a certain popover. If no selector is provided, the last opened popover is hidden

  • {DOM Element|String} selector Support multiple type input:
    • DOM Element: Popover trigger element
    • String: Popover ID
  • Returns {Promise.}
hideAll function

Hide all popovers