Reference Source
import ScrollListener from 'flarum/common/utils/ScrollListener'
public class | source

ScrollListener

The ScrollListener class sets up a listener that handles window scroll events.

Constructor Summary

Public Constructor
public

constructor(callback: Function)

Member Summary

Public Members
public

active: *

public
public

Method Summary

Public Methods
public

start()

Start listening to and handling the window's scroll position.

public

stop()

Stop listening to and handling the window's scroll position.

public

update()

Run the callback, whether there was a scroll event or not.

Protected Methods
protected

loop()

On each animation frame, as long as the listener is active, run the update method.

Public Constructors

public constructor(callback: Function) source

Params:

NameTypeAttributeDescription
callback Function

The callback to run when the scroll position changes.

Public Members

public active: * source

public callback: * source

public ticking: boolean source

Public Methods

public start() source

Start listening to and handling the window's scroll position.

public stop() source

Stop listening to and handling the window's scroll position.

public update() source

Run the callback, whether there was a scroll event or not.

Protected Methods

protected loop() source

On each animation frame, as long as the listener is active, run the update method.