All Projects → davguij → angular-http-cache

davguij / angular-http-cache

Licence: MIT license
Speed up your remote requests by automatically caching them on client and add support for offline navigation.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to angular-http-cache

Wq.app
💻📱 wq's app library: a JavaScript framework powering offline-first web & native apps for geospatial data collection, mobile surveys, and citizen science. Powered by Redux, React, Material UI and Mapbox GL.
Stars: ✭ 99 (+296%)
Mutual labels:  offline, offline-first
Jfa Pwa Toolkit
⚡️ PWA Features to Any Website (very Fast & Easy)
Stars: ✭ 245 (+880%)
Mutual labels:  offline, offline-first
Wora
Write Once, Render Anywhere. typescript libraries: cache-persist, apollo-offline, relay-offline, offline-first, apollo-cache, relay-store, netinfo, detect-network
Stars: ✭ 138 (+452%)
Mutual labels:  offline, offline-first
Storage Based Queue
Javascript queue library with persistent storage based queue mechanism for the browsers environments. Specially designed for offline.
Stars: ✭ 33 (+32%)
Mutual labels:  offline, offline-first
po-util
Classic Edition of po-util: The Ultimate Local Particle Experience for Linux and macOS
Stars: ✭ 51 (+104%)
Mutual labels:  local, offline
Tris Webpack Boilerplate
A Webpack boilerplate for static websites that has all the necessary modern tools and optimizations built-in. Score a perfect 10/10 on performance.
Stars: ✭ 1,016 (+3964%)
Mutual labels:  offline, offline-first
Ember Service Worker
A pluggable approach to Service Workers for Ember.js
Stars: ✭ 227 (+808%)
Mutual labels:  offline, offline-first
Ios Pwa Wrapper
An iOS Wrapper application to create a native iOS App from an offline-capable Progressive Web App.
Stars: ✭ 268 (+972%)
Mutual labels:  offline, offline-first
facebook-send-api-emulator
Facebook Messenger Emulator & Facebook Send API Emulator functionality allowing you to test web hooks on developer's machine.
Stars: ✭ 24 (-4%)
Mutual labels:  local, offline
Offline First
🔌 Everything you need to know to create offline-first web apps.
Stars: ✭ 2,792 (+11068%)
Mutual labels:  offline, offline-first
Sw Precache
Service Worker Precache is a module for generating a service worker that precaches resources. It integrates with your build process. Once configured, it detects all your static resources (HTML, JavaScript, CSS, images, etc.) and generates a hash of each file's contents. Information about each file's URL and versioned hash are stored in the generated service worker file, along with logic to serve those files cache-first, and automatically keep those files up to date when changes are detected in subsequent builds.
Stars: ✭ 5,276 (+21004%)
Mutual labels:  offline, offline-first
Dianoia-app
Mobile (Ionic 3 - Angular 4) app about non-pharmaceutical activities and information for people with dementia.
Stars: ✭ 13 (-48%)
Mutual labels:  offline-first, angular2
Upup
✈️ Easily create sites that work offline as well as online
Stars: ✭ 4,777 (+19008%)
Mutual labels:  offline, offline-first
Gittar
🎸 Download and/or Extract git repositories (GitHub, GitLab, BitBucket). Cross-platform and Offline-first!
Stars: ✭ 87 (+248%)
Mutual labels:  offline, offline-first
Offline Plugin
Offline plugin (ServiceWorker, AppCache) for webpack (https://webpack.js.org/)
Stars: ✭ 4,444 (+17676%)
Mutual labels:  offline, offline-first
Apollo Offline
An offline toolkit for the Apollo client
Stars: ✭ 186 (+644%)
Mutual labels:  offline, offline-first
Android Pwa Wrapper
Android Wrapper to create native Android Apps from offline-capable Progressive Web Apps
Stars: ✭ 265 (+960%)
Mutual labels:  offline, offline-first
Kinto.js
An Offline-First JavaScript Client for Kinto.
Stars: ✭ 268 (+972%)
Mutual labels:  offline, offline-first
Ionic Cache
Ionic and Angular cache service with IndexedDB, SQLite and WebSQL support
Stars: ✭ 248 (+892%)
Mutual labels:  offline, angular2
data-api-suite
Monorepo that includes libraries, Serverless Framework plugins and development tools to simplify and enhance the development, deployment and use of the Data API for Aurora Serverless.
Stars: ✭ 23 (-8%)
Mutual labels:  local, offline

Angular HTTP Cache

What's this?

This project adds an "offline-first" approach to the regular Http service. Responses are saved to local persistence and then served from there on subsequent requests.

How does it work?

Basically, the module uses its own extended Http replacement service to save the response to every request into the browser's local persistence.

So for every request, the service will first look for a matching response in its local persistence; if it exists, it will emit that response first.

Regardless of the previous step, the service will perform the HTTP request and will emit updated data if necessary.

How to use it?

The module is a replacement for the native HttpModule, so it's intended to be easy to be dropped in.

Its methods are identical to the native module.

The code works fine with JSON-formatted HTTP responses. It can be also used for other types of responses, such as images, but it hasn't been properly tested yet, so please use with caution.

Installing it

npm install ng-http-cache --save

Importing it

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { HttpCacheModule } from 'ng-http-cache';

@NgModule({
  imports: [
    BrowserModule,
    HttpCacheModule
  ]
})
export class ExampleModule { }

Using it

import { Http } from '@angular/http';
export class ExampleComponent implements OnInit {
  constructor(private http: Http) { }

  ngOnInit() {
    this.http.get('http://api.example.com/example')
	  // There's no need to 'map' the response, the service does it for you!
      .subscribe((resp) => { 
        console.log(resp);
      });
  }
}

More stuff

Get in touch

Feel free to drop me a line if you have an issue, doubt, problem or suggestion, even just to tell me what you think. You can leave an issue here or give me a shout on Twitter.

To-do

  1. Check the network status and don't make the request if offline.
  2. Include unit tests.
  3. Add JSONP support.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].