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

ngx-http-get-shell

v0.0.4

Published

A lightweight Angular GET shell component to help reduce creating repetitive code of HttpClient GET APIs. This component has built-in support for **client-side cache** storage supported by IndexedDB.

Downloads

5

Readme

ngx-http-get-shell

A lightweight Angular GET shell component to help reduce creating repetitive code of HttpClient GET APIs. This component has built-in support for client-side cache storage supported by IndexedDB.

Installation

Install the npm package.

  npm i ngx-http-get-shell

Import it into your root AppModule:

  import { NgxHttpGetShellModule } from 'ngx-http-get-shell';

@NgModule({
  imports: [
    ...
    NgxHttpGetShellModule.forRoot(),
    ...
  ],
})
export class AppModule { }

Usage

This library is super easy-to-use, all you need is to pass the url you want to get data from into ngx-http-get-shell, The url could be absolute HTTP URL or a relative url of your static files.

<ngx-http-get-shell url="https://api.github.com/users/theideasaler" [maxStale]="1000" [templateRef]="githubTmpl">
  <ng-template #githubTmpl let-data>
    {{ data | json }}
  </ng-template>
</ngx-http-get-shell>

<ngx-http-get-shell url="/assets/test.json" [maxStale]="3000" [templateRef]="staticTmpl">
  <ng-template #staticTmpl let-file>
    <div class="some wrapper elements">
      {{file | json}}
    </div>
  </ng-template>
</ngx-http-get-shell>

NgxHttpGetShellComponent

NgxHttpGetShellComponent exposes some I/O for custom configuration.

| I/O | name | type | description | |------|------|---------|-------------| | @Input | url | string | The URL to fetch data from. It will be used as the key from the cache. | | @Input | maxStale | number | Max Stale duration in milliseconds, default is 0, which means no cache. | | @Input | templateRef | TemplateRef | The template reference will be used to take the fetched and processed data. | | @Input | dataProcessor | Function | The processor for the fetched data before it is emitted. | | @Input | errorHandler | Function | The error handler for the data fetching. | | @Output | dataLoaded | EventEmitter | Emitted when the data is loaded and processed. You can use this for your custom data handling. |

IndexedDbService

This library also exposes IndexedDbService for you so that you can have more control of the indexedDB for your caching.

| method | type | description | |------|---------|-------------| | cleanup | static | Cleans up the database by removing expired items. This method will be called when NgxHttpGetShellModule is initialized. | | setItem | instance | Adds an item to the database. | | getItem | instance | Gets an item from the database | | removeItem | instance | Deletes an item from the database | | clearAll | instance | Clear all items from the database | | getDb | instance | The the indexed db instance used by this service |