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

dmgload

v1.0.4

Published

Highly performant, light and configurable lazy loader in pure JS with no dependencies for images in H5.

Downloads

22

Readme

Dmgload

Highly performant, light and configurable lazy loader in pure JS with no otherdependencies for H5.

Features

  • lazy loads elements performantly using pure JavaScript
  • high performant and very small size ( Bundle size: 1.47 KB, Gzipped size: 873 B )
  • design for mobile phone, can be used in android 2.3 and higher
  • solve ios scroll event only trigger at the ending
  • the most useful Feature, it support lazy-load Doms which is dynamic add to the document,you don't need call any other API。

中文

Install

# You can install dmgload with npm
$ npm install --save dmgload

Usage

Then with a module bundler like rollup or webpack, use as you would anything else:

// using ES6 modules
import dmgload from 'dmgload';
dmgload.lazyload();

// using CommonJS modules
var dmgload = require('dmgload');
dmgload.lazyload();
<script type="text/javascript" src="/dist/dmgload.min.js"></script>
<script type="text/javascript"> dmgload.lazyload();</script>

In HTML, add an identifier to the element (default selector identified is lazyload class):

<img class="lazyload" data-src="image.png" />

Desc and Reference

you can also set some options to controll the actions

import dmgload from 'Dmgload';
dmgload.lazyload{
    selector: ".lazyload",
    offset: 50,  //偏移量,在距离视口多远的时候就开始加载
    debounce_time: 30, //防抖时间,在该时间内时是不会重复触发了。
    throttle_time: 300,  //节流时间,在超过该时间之后一定要触发的。
    default_img: 'data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAABFCAYAAAAB8xWyAAAACXBIWXMAAAsSAAALEgHS3X78AAAAJUlEQVRoge3BMQEAAADCoPVP7WMMoAAAAAAAAAAAAAAAAAAA4AY6fQABFpNNRwAAAABJRU5ErkJggg==' // 在图片失效的时候使用的默认替代图片
};