Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DataLogger

Hierarchy

  • DataLogger

Index

Constructors

constructor

Properties

Private database

database: Database

Database where to store logged data.

Private itemClickCallbacks

itemClickCallbacks: Map<ItemID, function>

Map from item IDs to onclick callbacks attached to them. This is required to detach such handlers from the item nodes if need be.

Private pageLoadTimestamp

pageLoadTimestamp: number

Timestamp of the page load. This is required to measure the visit duration on page leave.

Methods

init

  • Start logging item clicks and page visits.

    Parameters

    • menuManager: MenuManager

      The menu manager with menu items to watch.

    Returns void

onMenuItemClick

  • onMenuItemClick(event: Event, item: Item): void
  • Handle an item click (click event) by logging it into the database.

    Parameters

    • event: Event

      The click event issued on the item node click.

    • item: Item

      The clicked item.

    Returns void

onPageBeforeUnload

  • onPageBeforeUnload(event: Event): void
  • Handle a page leave (`beforeunload event) by logging the visit into the database.

    Parameters

    • event: Event

      The beforeunload event issued on the page leave.

    Returns void

startListeningForAllMenusItemClicks

  • startListeningForAllMenusItemClicks(menuManager: MenuManager): void
  • Start logging clicks on the nodes of all the items of all menus.

    Parameters

    • menuManager: MenuManager

      The menu manager handling all the items to start watching.

    Returns void

startListeningForItemClicks

  • startListeningForItemClicks(items: Item[]): void
  • Start logging clicks on the nodes of the given items.

    Parameters

    • items: Item[]

      The items to start watching.

    Returns void

startListeningForMenuItemClicks

  • startListeningForMenuItemClicks(menu: Menu): void
  • Start logging clicks on the nodes of all the items of the given menu.

    Parameters

    • menu: Menu

      The menu containing items to start watching.

    Returns void

startListeningForPageBeforeUnload

  • startListeningForPageBeforeUnload(): void
  • Start logging the current page visit by listening for a beforeunload event.

    Returns void

stopListeningForAllMenusItemClicks

  • stopListeningForAllMenusItemClicks(menuManager: MenuManager): void
  • Stop logging clicks on the nodes of all the items of all menus.

    Parameters

    • menuManager: MenuManager

      The menu manager handling all the items to stop watching.

    Returns void

stopListeningForItemClicks

  • stopListeningForItemClicks(items: Item[]): void
  • Stop logging clicks on the nodes of the given items.

    Parameters

    • items: Item[]

      The items to stop watching.

    Returns void

stopListeningForMenuItemClicks

  • stopListeningForMenuItemClicks(menu: Menu): void
  • Stop logging clicks on the nodes of all the items of the given menu.

    Parameters

    • menu: Menu

      The menu containing items to stop watching.

    Returns void

Generated using TypeDoc