Optionalprops: IProgressPreloaderStaticProps & IProgressPreloaderMutableProps & Partial<OptionalonCallbacks: Partial<Retrieves the module's callbacks instance.
Checks if the module has been destroyed.
Returns whether the preloader is currently hidden.
Loaded weight
Current loading progress (0 to 1).
The name of the module, derived from the class name
Optional prefix for classnames used by the module
Gets the current progress value.
Current properties. Do not mutate these directly, use updateProps instead.
Container source for preloader resources.
The list of custom resources to preload.
Calculates the total number of resources to preload, including their weight.
Protected_addAdds a class name on an element, and keeps track of it for removal when the module is destroyed.
The target DOM element.
The class name to toggle.
Protected_cnHelper function to generate classnames with the module's prefix.
The class names to generate.
A string of class names with the module's prefix applied.
Protected_destroyCleans up resources and destroys the preloader instance.
Retrieves the default mutable properties.
Retrieves the default static properties.
The container for the preloader. Set it to null if you only need the preloader logic.
Selector for custom resources to preload. Elements should include data-weight and data-loaded attributes.
Example: data-weight="10" for a weight of 10, data-loaded="10" when loaded.
Duration (ms) to complete the preloader if resources are loaded but progress < 1.
Defines whether to automatically hide the preloader container.
false: Disables the hiding animation, allowing you to manage it manually.number: Specifies the animation duration in milliseconds.
This works only if the container is an HTML element.Class name for elements to exclude from preloading.
Linear interpolation factor for smooth progress updates. 1 disables interpolation for instant updates.
Enables automatic preloading of images.
Enables automatic preloading of videos.
Container source for preloader resources.
Protected_handleMethod that is called when the module's properties mutate. In most cases, used to handle callbacks.
Protected_onResolves when the page and all resources are fully loaded.
Adds a custom resource
The custom resource element or identifier to preload.
The resource weight
Destroys the module, cleaning up resources, callbacks, and event listeners.
Hides the preloader with a custom animation duration.
The duration of the hide animation (in milliseconds). Applies only when the container is used.
Optionalcallback: () => voidThe callback to execute when the hide animation is complete.
Returns an action destructor.
Adds a custom callback to the module.
The event type to listen for (e.g., 'props', 'destroy').
The function to execute when the event is triggered.
Additional settings for the callback.
Adds a callback on the module's destruction.
The function to execute during destruction.
Registers a callback for when the preloader is fully hidden.
The callback function to execute.
A destructor.
Registers a callback for when the preloader starts hiding.
The callback function to execute.
A destructor.
Emits a resource load event and updates the count of loaded resources.
The resource element or identifier being loaded.
OptionalloadedWeight: numberChange module's mutable properties
Page preloader for calculating and displaying the loading progress of resources (images, videos, custom elements). Provides smooth progress transitions.
Documentation