Class: EventStrategy

VisSense.VisMon.Strategy. EventStrategy

A strategy that registers listeners for events that may change the percentage of the elements surface area within the visible area of a viewer's browser window.

Following events are listened to: - scroll - resize - visibilitychange

new EventStrategy()

Example
var visMon = VisSense(...).monitor({
  strategy: new VisSense.VisMon.Strategy.EventStrategy({
     throttle: 100
  }),
  update: function() {
    console.log('updated.');
  }
}).start();

Extends

Methods

init(monitor)

The init method is called when a monitor is created and has not started yet.

Parameters:
Name Type Description
monitor VisSense.VisMon
Inherited From:

start(monitor)

Parameters:
Name Type Description
monitor VisSense.VisMon

stop(monitor)

Parameters:
Name Type Description
monitor VisSense.VisMon

Type Definitions

EventStrategyConfig

A configuration object to configure a EventStrategy instance.

Type:
  • Object
Properties:
Name Type Argument Default Description
throttle number <optional>
50

The time in milliseconds to debounce the state update. Event might fire multiple times in a short period of time. If you want this feature to be disabled set debounce to 0. in milliseconds.