react-clear-cache
Advanced tools
Comparing version
@@ -5,4 +5,5 @@ import * as React from 'react'; | ||
children: any; | ||
relativePath?: any; | ||
}; | ||
declare const ClearCache: React.FC<OwnProps>; | ||
export default ClearCache; |
@@ -9,8 +9,8 @@ import { useRef, useEffect, useState } from 'react'; | ||
var ClearCache = function (_a) { | ||
var _b = _a.duration, duration = _b === void 0 ? 60 * 1000 : _b, children = _a.children; | ||
var _c = useState(true), loading = _c[0], setLoading = _c[1]; | ||
var _d = useState(false), isLatestVersion = _d[0], setIsLatestVersion = _d[1]; | ||
var _e = useState(''), latestVersion = _e[0], setLatestVersion = _e[1]; | ||
var _b = _a.relativePath, relativePath = _b === void 0 ? '' : _b, _c = _a.duration, duration = _c === void 0 ? 60 * 1000 : _c, children = _a.children; | ||
var _d = useState(true), loading = _d[0], setLoading = _d[1]; | ||
var _e = useState(false), isLatestVersion = _e[0], setIsLatestVersion = _e[1]; | ||
var _f = useState(''), latestVersion = _f[0], setLatestVersion = _f[1]; | ||
var useAppVersionState = createPersistedState('appVersion'); | ||
var _f = useAppVersionState(''), appVersion = _f[0], setAppVersion = _f[1]; | ||
var _g = useAppVersionState(''), appVersion = _g[0], setAppVersion = _g[1]; | ||
function emptyCacheStorage() { | ||
@@ -35,3 +35,3 @@ console.log('Clearing cache and hard reloading...'); | ||
function fetchMeta() { | ||
fetch('/meta.json', { | ||
fetch(relativePath + "/meta.json", { | ||
cache: 'no-store' | ||
@@ -45,3 +45,3 @@ }) | ||
if (shouldForceRefresh) { | ||
console.log('An update is avaialbe!'); | ||
console.log('An update is available!'); | ||
if (!appVersion) { | ||
@@ -48,0 +48,0 @@ setAppVersion(newVersion); |
@@ -13,8 +13,8 @@ 'use strict'; | ||
var ClearCache = function (_a) { | ||
var _b = _a.duration, duration = _b === void 0 ? 60 * 1000 : _b, children = _a.children; | ||
var _c = React.useState(true), loading = _c[0], setLoading = _c[1]; | ||
var _d = React.useState(false), isLatestVersion = _d[0], setIsLatestVersion = _d[1]; | ||
var _e = React.useState(''), latestVersion = _e[0], setLatestVersion = _e[1]; | ||
var _b = _a.relativePath, relativePath = _b === void 0 ? '' : _b, _c = _a.duration, duration = _c === void 0 ? 60 * 1000 : _c, children = _a.children; | ||
var _d = React.useState(true), loading = _d[0], setLoading = _d[1]; | ||
var _e = React.useState(false), isLatestVersion = _e[0], setIsLatestVersion = _e[1]; | ||
var _f = React.useState(''), latestVersion = _f[0], setLatestVersion = _f[1]; | ||
var useAppVersionState = createPersistedState('appVersion'); | ||
var _f = useAppVersionState(''), appVersion = _f[0], setAppVersion = _f[1]; | ||
var _g = useAppVersionState(''), appVersion = _g[0], setAppVersion = _g[1]; | ||
function emptyCacheStorage() { | ||
@@ -39,3 +39,3 @@ console.log('Clearing cache and hard reloading...'); | ||
function fetchMeta() { | ||
fetch('/meta.json', { | ||
fetch(relativePath + "/meta.json", { | ||
cache: 'no-store' | ||
@@ -49,3 +49,3 @@ }) | ||
if (shouldForceRefresh) { | ||
console.log('An update is avaialbe!'); | ||
console.log('An update is available!'); | ||
if (!appVersion) { | ||
@@ -52,0 +52,0 @@ setAppVersion(newVersion); |
{ | ||
"name": "react-clear-cache", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "A component to manage application updates.", | ||
@@ -5,0 +5,0 @@ "author": "noahjohn9259", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
29509
1.29%181
0.56%