Skip to main content
This module provides utility methods for common operations.

addEventListener

The addEventListener() method attaches an event handler to the specified element.
Kameleoon resets all event listeners created via this API during engine reloads. Use this method to add listeners in SPAs to ensure proper cleanup.
Arguments

addUniversalClickListener

The addUniversalClickListener() method attaches a click handler that listens for mouse clicks on desktop and touchdown events on mobile devices and tablets. For mobile devices, a touchdown occurs if the engine detects a touchstart event followed by a touchend event without an intermediate touchmove.
Kameleoon resets all listeners created via this API during engine reloads, facilitating cleanup in SPAs.
On desktop devices, right-clicks trigger this method, for example, when opening a link in a new tab.
Arguments

clearInterval

The clearInterval() method clears a timer you set through setInterval().
Arguments

clearTimeout

The clearTimeout() method clears a timer you set through setTimeout().
Arguments

computeHash

The computeHash() method computes a hash from a string. Use this to process unique data without manipulating sensitive personal information directly.
Arguments Return value

getURLParameters

The getURLParameters() method parses the current URL and returns all detected parameters. This method supports both search (?) and hash (#) parameters.
Return value

performRequest

The performRequest() method initiates a call to a remote web server.
Arguments

querySelectorAll

The querySelectorAll() method returns all document elements matching the specified CSS selectors as a static NodeList object.
This method supports selectors with :contains and :eq.
Arguments Return value

setInterval

The setInterval() method executes a function or expression at the specified interval in milliseconds. Kameleoon resets all intervals created via this API during engine reloads. Use this method in SPAs to ensure proper cleanup.
Arguments Return value

setTimeout

The setTimeout() method executes a function or expression after the specified number of milliseconds. Kameleoon resets all timeouts created via this API during engine reloads. Use this method in SPAs to ensure proper cleanup.
Arguments Return value