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

leaflet-loading

v0.1.24

Published

A simple loading control for Leaflet

Downloads

4,990

Readme

Leaflet.loading

Leaflet.loading is a simple loading control for Leaflet. An unobtrusive loading indicator is added below the zoom control if one exists. The indicator is visible when tiles are loading or when other data is loading, as indicated by firing custom events on a map. The indicator can be an image, or a spin.js spinner (image-less).

Usage

Leaflet.loading is only tested on Leaflet version 0.6 or greater. It will almost certainly not work with older versions of Leaflet. Of course we intend to support Leaflet 1.0, and we have tested against the latest release (beta 2). Please create an issue if you find that any part of this project is not compatible with Leaflet 1.0.

Include Control.Loading.js and Control.Loading.css, then create a map with loadingControl: true in its options.

By default, Leaflet.loading includes a base64-encoded animagted loading image in Control.Loading.css. You can customize this by changing background-image for the selector .leaflet-control-loading. The simplest case would be adding a 16 x 16 loading gif in .leaflet-control-loading.

You can also set spinjs: true in the options, and load spin.js to use that instead of an image. A spin.js options object can be passed as the spin key when initializing the control.

Whichever method you use, make sure you only use one.

Once the above is complete you will have a loading indicator that only appears when tiles are loading.

If you want to show the loading indicator while other AJAX requests or something else is occurring, fire the dataloading event on your map when you begin loading and dataload when you are finished loading. Please note that there is an issue with the way this control tracks these events and that this will be re-worked in a future version.

Options

  • position: (string) Where you want the control to show up on the map (standard Leaflet control option). Optional, defaults to topleft

  • separate: (boolean) Whether the control should be separate from the zoom control or not, defaults to false.

  • zoomControl: (L.Control.Zoom) The zoom control that the control should be added to. This is only necessary when adding a loading control to a zoom control that you added manually and do not want a separate loading control.

  • delayIndicator: (float) The number of milliseconds to wait before showing the loading indicator. Defaults to null (no delay).

  • spinjs: (boolean) Enable the use of spin.js. Optional, defaults to false

  • spin: (object) A spin.js options object. Optional, defaults to

    {
        lines: 7,
        length: 3,
        width: 3,
        radius: 5,
        rotate: 13,
        top: "83%"
    }

Demos

See Leaflet.loading in action (zoom or pan to make tiles load):

License

Leaflet.loading is free software, and may be redistributed under the MIT License.