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 🙏

© 2025 – Pkg Stats / Ryan Hefner

instant-load

v1.1.1

Published

A JavaScript library to speed up your site

Readme

InstantLoad

InstantLoadJS is a JavaScript library to speed up your site.

How does it work?

InstantLoad makes your website a one-page website by preloading the next page on your website when hovering a link. When the user clicks the link, the already loaded page replaces the current one with an instant transition. In addition InstantLoadJS offers seamless loading animations to make your website look even more modern.

Install

CDN:

https://unpkg.com/[email protected]/instantload.min.js

NPM:

npm i instant-load

Initialize

Place the InstantLoad script on the bottom of your webpage, before any other scripts, like this:

<script src="/path/to/instantload.min.js" instantload-blacklist></script>

After adding the instantload.min.js script to your site, you'll need to initialize the library by adding this script after it:

<script instantload-blacklist>InstantLoad.init();</script>

It's important to keep the instantload-blacklist attribute on the scripts above.

Configure

InstantLoad offers high level customizations via it's config. You can pass your settings through the InstantLoad.init() function, like this:

InstantLoad.init({reloadPagesOnPopstate: false, loadingStyle: InstantLoad.configOptions.loadingStyles.circle});

Full list of config options

|Config property name |Type |Description | |---------------------|-------------------------------|-----------------------------| |reloadPagesOnPopstate|boolean |If true, on pressing the back/forward button, the target page will be reloaded. Default: false| |loadingStyle |InstantLoad.configOptions.loadingStyles |Customize the loading transition.Possible values:- bar - blink- circle- invisibleDefault: bar|

More coming soon...

API

The InstantLoad object returns some useful values. Let's take a look at them!

InstantLoad.init()

This will initialize the InstantLoad script and start speeding up you site

InstantLoad.config()

This will return the current config for the library. You can also use it to change the config, after initializing InstantLoad.

InstantLoad.on('eventType', callback)

Used to add your own events to InstantLoad. More belove

InstantLoad.history

This will return the history of your site, after initializing the library.

InstantLoad.configOptions

This stores the options for different config elements

InstantLoad.isRunning

Check if InstantLoad had been initialized

Blacklisting scripts

If you don't want your scripts to get re-inserted and re-initialized, you will find the instantload-blacklist attribute really useful. Add it to your scripts to blacklist it from InstantLoad, like this:

<script src="/path/to/my/script.js" instantload-blacklist></script>

Event Handling

InstantLoad has it's own events, and you can listen to them like this:

InstantLoad.on('change', function(event) {console.log('Page changed', event)});

Event types

|Event type|Return values |Description| |----------|-----------|-----------| |init |eventType: inittrackedElements: All preloadable elements |Occurs after the initialization of InstantLoad| |preload |eventType: preload |Occurs before preloading a page, when hovering a link| |postload|eventType: postloadsuccess: Whether the request was successfulmessage: Request message |Occurs after preloading a page, when hovering a link| |change |eventType: changepopstateEvent: Whether the change was triggered by the back/forward arrows or not |Occurs after changing the page|

Customize the loading styles

You can configure the different loading styles via CSS. You can find the CSS selectors to use above. |Selector |Element | |---------------------|-------------------------------| |#instantload-bar |The loading line of the bar styled loading| |#instantload-whiteScreen|The blink styled loading's layer| |#instantload-circle|The circle styled spinner loading's container| |#instantload-circle-spinner|The circle styled loading's spinner|

Why did I make this library?

I was working on a project of mine, and I wanted to use the well-known instantclick.io library, but I realized, that while it is great and very much useful, it lacks some customizations I'd like to use and it is a bit buggy.

So I sat down and wrote my own version of it.

Hope you like it :) Thank you for the inspiration instantclick

Contributions

You are more than welcome contributing to the library.

Make sure to do npm install, after cloning the repository to install UglifyJs as a devDependency. Use this command to minify:

uglifyjs instantload.js --output instantload.min.js --mangle --source-map

Please make a pull request if you have implemented something new