Optional
props: StaticProps & MutablePropsProtected
_callbacksCallbacks instance
Protected
_destroyableStores actions that need to be executed when the module is destroyed
Protected
_isTracks whether the module has been destroyed
Protected
_isIndicates if the preloader has already been hidden.
Protected
_isIndicates if the page is fully loaded.
Protected
_progressCurrent interpolated progress value for smooth transitions.
Protected
_propsCurrent properties
Protected
_rafAnimation frame instance for managing smooth progress updates.
Protected
_resourcesList of custom resources to preload based on selectors.
Protected
_shouldIndicates if the preloader is in the process of being hidden.
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.
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.
Protected
_fetchPreload images
Protected
_fetchPreload custom resources
Protected
_fetchPreload videos
Retrieves the default mutable properties.
Retrieves the default static properties.
Protected
_handleHandles the logic that occurs after the page is fully loaded.
Protected
_handleMethod that is called when the module's properties mutate. In most cases, used to handle callbacks.
Protected
_handleHandles updates to the preloader's progress, triggering events and animations as needed.
The updated progress value.
Protected
_hideExecutes the hiding animation for the preloader container.
Protected
_onHandles actions when the preloader is fully hidden.
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.
Optional
callback: () => 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.
Optional
loadedWeight: number
Page preloader for calculating and displaying the loading progress of resources (images, videos, custom elements). Provides smooth progress transitions.
Documentation