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 visobjVisSense The VisSense element.
currentStateVisSense~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 topnumber The distance to the browsers top border.
rightnumber The distance to the browsers right border.
bottomnumber The distance to the browsers bottom border.
leftnumber The distance to the browsers left border.
-
Viewport
-
An object representing the current browser viewport.
Type:
- Object
Properties:
Name Type Description widthnumber width of the viewport.
heightnumber height of the viewport.