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

kwh-progressive-image-loader

v1.0.4

Published

**1.6KB** (Min + gzip) light Weight, OnPushed angular component to progressively load Image. Supports: - Animate Image Blur while switching URLS - Start loading On Custom Intersection and threshold - Custom Background Color Before loading

Downloads

2

Readme

ProgressiveImageLoader

1.6KB (Min + gzip) light Weight, OnPushed angular component to progressively load Image. Supports:

  • Animate Image Blur while switching URLS
  • Start loading On Custom Intersection and threshold
  • Custom Background Color Before loading

Installation

To add the Progressive Loader to your Angular project:

npm install --save kwh-progressive-image-loader

Once installed, add the Progressive Loader to your app.module.ts:

import { ProgressiveImageLoaderModule } from 'progressive-image-loader';

...

@NgModule({
   ...
   imports: [
     ...
     ProgressiveImageLoaderModule,
    ...
   ],
   ...
});
export class AppModule {}

Sample usage

Now you can use the Progressive loader component in your app components, for example in app.component.ts:

import { ProgressiveImageLoaderOptions } from 'progressive-image-loader';
...

@Component({...})
export class AppComponent {
    loadingOptions: ProgressiveImageLoaderOptions = {
        thumbnailUrl: <thumbnail_url>,
        originalUrl: <original_url>,
        backgroundColor: <background_color>,
        intersectionParent: <parent_to_observe_intersection>,
        blurWhileBackground: <blur_while_background_color>,
        blurWhileThumbnail: <blur_while_thumbnail_color>,
        animationTimeBetweenBackgroundAndThumbnail: <animation_time_bw_bg_and_thumbnail>,
        animationTimeBetweenThumbnailAndOriginal: <animation_time_bw_thumbnail_and_final_url>
    };
}

And in template file app.component.html:

<kwh-progressive-image-loader
[loadingOptions]="loadingOptions"
></kwh-progressive-image-loader>

Input Options

Below is the list of properties for loadingOptions

ProgressiveImageLoaderOptions

| Property | Optional | Default Value | dataType | description | | -------------- | ----- |------- | ------- | ---- | | thumbnailURL | false| - | string| thumbnail URL for the image to be loaded| | originalURL | false| - | string| Original URL for the image to be loaded| | backgroundColor | false| - | string| Background color before loading the thumbnail URL| | animationTimeBetweenBackgroundAndThumbnail | true| 300 (ms) | string| Time for which the blur should animate while applying thumbnail URL| | animationTimeBetweenThumbnailAndOriginal | true| 300 (ms) | string| Time for which the blur should animate while applying final (original) URL| | blurWhileBackground | true| 25 (px) | string| Blur value in pixels while background color is applied| | blurWhileThumbnail | true| 25 (px) | string| Blur value in pixels while thumbnail Image is applied| | intersectionParent | true| - | string| If intersection parent is provided, image will start loading once the image reaches the intersection threshold| | intersectionThreshold | true| 0.25 | string| fraction of image visible in the intersectionParent to trigger loading (between 0-1)|

Output Events

|Event| Description| OutputData |---|--------|---| | loadingFailed | When Image Loading Fails | ProgressStep

In case of failed loading, possible values of ProgressStep

|Value| Description| |--------|---| |FINAL_LOADING_FAILED | When Original Image failed to load| |THUMBNAIL_LOADING_FAILED| When Thumbnail Image Failed to load|

Further help / Suggestions

Contact me at [email protected]