1.2.0 • Published 17 days ago

ajax-cache-parser v1.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
17 days ago

ajax-cache-parser

NPM

Build Status Code Climate Test Coverage install size

A small function to get when an ajax request expires

Given an XMLHttpRequest object that has received response headers back from a server, getCacheExpiry will return a javascript Date object that represents when the response will expire based on the Expires and Cache-Control response headers. If caching headers are not present or are unparseable, undefined will be returned. If caching headers indicate that the resource should not be cached, null will be returned.

Example

function callback(){
  var expiration = parser.getCacheExpiry(this);
  // do something with expiration
}
var oReq = new XMLHttpRequest();
oReq.onload = callback;
oReq.open("get", yourUrl, true);
oReq.send();

Information about caching headers comes from: https://www.mnot.net/cache_docs/

1.2.0

17 days ago

1.1.8

1 year ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

5 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.0.1

9 years ago

1.1.0

9 years ago

1.0.0

10 years ago