Global

Methods

build(consumer) → {*|VisSense.VisMon}

Creates the configured monitor.

There is a special case in which all strategies are disabled and hence the caller has to take care of the update mechanism - this is especially useful for testing. This happens when the property 'strategy' is set to false or ends up being an empty array.

builder.set('strategy', false); or builder.options({ strategy: false });

Parameters:
Name Type Argument Description
consumer <optional>

if given will return this methods result as return parameter. The built monitor is passed as first argument.

Returns:
Type
* | VisSense.VisMon

<private> nextState(visobj, currentState) → {VisSense~VisState}

Parameters:
Name Type Argument Description
visobj VisSense

The VisSense element.

currentState VisSense~VisState <optional>

The current state. Can be omitted if the state of an element is determined the first time.

Returns:

A visibility state object.

This method determines and returns the new visibility state of an element.

Type
VisSense~VisState

Type Definitions

BoundingClientRect

An object representing a rectangle with properties ´top´, ´right´, ´bottom´ and ´left´ relative to the viewport.

Type:
  • Object
Properties:
Name Type Description
top number

The distance to the browsers top border.

right number

The distance to the browsers right border.

bottom number

The distance to the browsers bottom border.

left number

The distance to the browsers left border.

Viewport

An object representing the current browser viewport.

Type:
  • Object
Properties:
Name Type Description
width number

width of the viewport.

height number

height of the viewport.