npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

evolvethemes-preloadr

v1.0.0

Published

JavaScript library to detect when a given set of elements has fully loaded.

Downloads

6

Readme

Preloadr

Preloadr is a JavaScript library that allows you attach a number of elements to a loading queue, and fire and event only when all of them have been declared as "completed".

For example, when you're loading a web page, you may want to add some sort of preloading functionality, by adding a class to the <body> element of the page, only when, say, webfonts have loaded, and images in the top portion of the page are ready to be displayed.

Installation

Here's what you need to do to include the library in your project:

NPM

If you're using NPM and a tool such as Webpack, simply download the package with the following command:

npm install evolvethemes-preloadr --save

Standard way

Download the minified script from the dist folder in this repository (the master branch holds the latest release, while the dev branch is for development purposes).

Usage

Elements that need to be preloaded must be registered using the init function of the Preloadr object.

var queue = [
    "fonts",
    "images"
];

window.Preloadr.init( queue );

The above code essentially tells the Preloadr object that we need to wait for loading confirmation from two elements, before we can declare the loading of the page as concluded.

After the registration, we then proceed add the logic that will bring all the elements to completion. When an element has fully loaded, you can pass the information to the Preloadr object:

window.Preloadr.complete( "fonts" );

where "fonts" is the name of the module.

When a single element has loaded, the html element of the page will emit a evolvethemes-preloadr-element-$element-loaded event.

When all elements in the queue have loaded, the html element of the page will emit a evolvethemes-preloadr-loaded event.

What's Evolve Themes

At Evolve we're specialized in the creation of top notch products based on WordPress, and under the Evolve Themes brand we regularly publish and sell themes and plugins.