Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-clear-cache

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-clear-cache - npm Package Compare versions

Comparing version 1.0.26 to 1.1.0

8

dist/index.d.ts

@@ -5,5 +5,11 @@ import * as React from 'react';

auto?: boolean;
children: any;
children?: any;
};
export declare function useClearCache(props?: OwnProps): {
loading: boolean;
isLatestVersion: boolean;
emptyCacheStorage: (version: string) => Promise<void>;
latestVersion: string;
};
declare const ClearCache: React.FC<OwnProps>;
export default ClearCache;

16

dist/index.es.js

@@ -59,6 +59,6 @@ import { useRef, useEffect, useState } from 'react';

/* eslint-disable */
var _this = undefined;
var ClearCache = function (props) {
var _a = props.duration, duration = _a === void 0 ? 60 * 1000 : _a, _b = props.auto, auto = _b === void 0 ? false : _b, children = props.children;
function useClearCache(props) {
var _this = this;
if (props === void 0) { props = {}; }
var _a = props.duration, duration = _a === void 0 ? 60 * 1000 : _a, _b = props.auto, auto = _b === void 0 ? false : _b;
var _c = useState(true), loading = _c[0], setLoading = _c[1];

@@ -140,2 +140,9 @@ var _d = useState(true), isLatestVersion = _d[0], setIsLatestVersion = _d[1];

}, []);
return {
loading: loading, isLatestVersion: isLatestVersion, emptyCacheStorage: emptyCacheStorage, latestVersion: latestVersion
};
}
var ClearCache = function (props) {
var _a = useClearCache(props), loading = _a.loading, isLatestVersion = _a.isLatestVersion, emptyCacheStorage = _a.emptyCacheStorage;
var children = props.children;
return children({

@@ -149,2 +156,3 @@ loading: loading,

export default ClearCache;
export { useClearCache };
//# sourceMappingURL=index.es.js.map

@@ -63,6 +63,6 @@ 'use strict';

/* eslint-disable */
var _this = undefined;
var ClearCache = function (props) {
var _a = props.duration, duration = _a === void 0 ? 60 * 1000 : _a, _b = props.auto, auto = _b === void 0 ? false : _b, children = props.children;
function useClearCache(props) {
var _this = this;
if (props === void 0) { props = {}; }
var _a = props.duration, duration = _a === void 0 ? 60 * 1000 : _a, _b = props.auto, auto = _b === void 0 ? false : _b;
var _c = React.useState(true), loading = _c[0], setLoading = _c[1];

@@ -144,2 +144,9 @@ var _d = React.useState(true), isLatestVersion = _d[0], setIsLatestVersion = _d[1];

}, []);
return {
loading: loading, isLatestVersion: isLatestVersion, emptyCacheStorage: emptyCacheStorage, latestVersion: latestVersion
};
}
var ClearCache = function (props) {
var _a = useClearCache(props), loading = _a.loading, isLatestVersion = _a.isLatestVersion, emptyCacheStorage = _a.emptyCacheStorage;
var children = props.children;
return children({

@@ -152,3 +159,4 @@ loading: loading,

exports.useClearCache = useClearCache;
exports.default = ClearCache;
//# sourceMappingURL=index.js.map
{
"name": "react-clear-cache",
"version": "1.0.26",
"version": "1.1.0",
"description": "A component to manage application updates.",

@@ -50,3 +50,3 @@ "author": "noahjohn9259",

"gh-pages": "^1.2.0",
"react-scripts": "3.0.1",
"react-scripts": "^3.3.1",
"rollup": "^0.62.0",

@@ -53,0 +53,0 @@ "rollup-plugin-babel": "^3.0.7",

@@ -30,6 +30,8 @@ # react-clear-cache

### Using `render props`:
```tsx
import * as React from 'react';
import * as React from "react";
import ClearCache from 'react-clear-cache';
import ClearCache from "react-clear-cache";

@@ -40,3 +42,3 @@ const App: React.FC<{}> = () => {

<ClearCache>
{({ isLatestVersion, emptyCacheStorage }) =>
{({ isLatestVersion, emptyCacheStorage }) => (
<div>

@@ -57,3 +59,3 @@ {!isLatestVersion && (

</div>
}
)}
</ClearCache>

@@ -67,2 +69,33 @@ </div>

### Using `hooks`:
```tsx
import * as React from "react";
import { useClearCache } from "react-clear-cache";
const App: React.FC<{}> = () => {
const { isLatestVersion, emptyCacheStorage } = useClearCache();
return (
<div>
{!isLatestVersion && (
<p>
<a
href="#"
onClick={e => {
e.preventDefault();
emptyCacheStorage();
}}
>
Update version
</a>
</p>
)}
</div>
);
};
export default App;
```
## Props

@@ -69,0 +102,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc