Module: utils

Provides utility functions and basic protection mechanisms for the application. This module includes functions to retrieve film and series data, escape strings for HTML/JS, debounce function calls, and handle errors by redirecting to an error page. It also includes basic protection against developer tools usage by preventing context menu actions, disabling certain key combinations, and detecting if developer tools are open.
Source:

Methods

(inner) debounce(func, wait) → {function}

Creates a debounced version of a function that delays its execution. Useful for limiting the rate at which a function is called, such as during user input events.
Parameters:
Name Type Description
func function The function to debounce.
wait number The delay in milliseconds.
Source:
Returns:
A debounced version of the original function.
Type
function

(inner) escapeForHTML(str) → {string}

Escapes backslashes and single quotes in a string for safe HTML/JS injection. Commonly used to prevent syntax errors when embedding strings inside HTML attributes or JS code.
Parameters:
Name Type Description
str string The string to escape.
Source:
Returns:
The escaped string.
Type
string

(inner) getFilmByTitle(title) → {Object}

Retrieves a film object by its title from the film's data.
Parameters:
Name Type Description
title The title of the film to retrieve.
Source:
Returns:
- The film object containing metadata like title, description, genres, etc.
Type
Object

(inner) getSeriesByTitle(title) → {Object}

Retrieves a series object by its title from the series data.
Parameters:
Name Type Description
title The title of the series to retrieve.
Source:
Returns:
- The series object containing metadata like title, description, seasons, etc.
Type
Object

(inner) handleErrorAndRedirect(message)

Redirects the user to an error page and stores a custom error message in localStorage.
Parameters:
Name Type Description
message string The message to display on the error page.
Source: