react-clear-cache
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -11,6 +11,6 @@ import * as React from 'react'; | ||
} & typeof defaultProps; | ||
export declare const useClearCache: (props: OwnProps) => { | ||
export declare const useClearCache: (props?: OwnProps | undefined) => { | ||
loading: boolean; | ||
isLatestVersion: boolean; | ||
emptyCacheStorage: (version: string) => Promise<void>; | ||
emptyCacheStorage: (version?: string | undefined) => Promise<void>; | ||
latestVersion: string; | ||
@@ -17,0 +17,0 @@ }; |
@@ -125,29 +125,34 @@ import { useRef, useEffect, useState } from 'react'; | ||
function fetchMeta() { | ||
fetch(baseUrl, { | ||
cache: 'no-store' | ||
}) | ||
.then(function (response) { return response.json(); }) | ||
.then(function (meta) { | ||
var newVersion = meta.version; | ||
var currentVersion = appVersion; | ||
var isUpdated = newVersion === currentVersion; | ||
if (!isUpdated && !auto) { | ||
console.log('An update is available!'); | ||
setLatestVersion(newVersion); | ||
setLoading(false); | ||
if (appVersion) { | ||
setIsLatestVersion(false); | ||
try { | ||
fetch(baseUrl, { | ||
cache: 'no-store' | ||
}) | ||
.then(function (response) { return response.json(); }) | ||
.then(function (meta) { | ||
var newVersion = meta.version; | ||
var currentVersion = appVersion; | ||
var isUpdated = newVersion === currentVersion; | ||
if (!isUpdated && !auto) { | ||
console.log('An update is available!'); | ||
setLatestVersion(newVersion); | ||
setLoading(false); | ||
if (appVersion) { | ||
setIsLatestVersion(false); | ||
} | ||
else { | ||
setVersion(newVersion); | ||
} | ||
} | ||
else if (!isUpdated && auto) { | ||
emptyCacheStorage(newVersion); | ||
} | ||
else { | ||
setVersion(newVersion); | ||
setIsLatestVersion(true); | ||
setLoading(false); | ||
} | ||
} | ||
else if (!isUpdated && auto) { | ||
emptyCacheStorage(newVersion); | ||
} | ||
else { | ||
setIsLatestVersion(true); | ||
setLoading(false); | ||
} | ||
}); | ||
}); | ||
} | ||
catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
@@ -154,0 +159,0 @@ useEffect(function () { |
@@ -129,29 +129,34 @@ 'use strict'; | ||
function fetchMeta() { | ||
fetch(baseUrl, { | ||
cache: 'no-store' | ||
}) | ||
.then(function (response) { return response.json(); }) | ||
.then(function (meta) { | ||
var newVersion = meta.version; | ||
var currentVersion = appVersion; | ||
var isUpdated = newVersion === currentVersion; | ||
if (!isUpdated && !auto) { | ||
console.log('An update is available!'); | ||
setLatestVersion(newVersion); | ||
setLoading(false); | ||
if (appVersion) { | ||
setIsLatestVersion(false); | ||
try { | ||
fetch(baseUrl, { | ||
cache: 'no-store' | ||
}) | ||
.then(function (response) { return response.json(); }) | ||
.then(function (meta) { | ||
var newVersion = meta.version; | ||
var currentVersion = appVersion; | ||
var isUpdated = newVersion === currentVersion; | ||
if (!isUpdated && !auto) { | ||
console.log('An update is available!'); | ||
setLatestVersion(newVersion); | ||
setLoading(false); | ||
if (appVersion) { | ||
setIsLatestVersion(false); | ||
} | ||
else { | ||
setVersion(newVersion); | ||
} | ||
} | ||
else if (!isUpdated && auto) { | ||
emptyCacheStorage(newVersion); | ||
} | ||
else { | ||
setVersion(newVersion); | ||
setIsLatestVersion(true); | ||
setLoading(false); | ||
} | ||
} | ||
else if (!isUpdated && auto) { | ||
emptyCacheStorage(newVersion); | ||
} | ||
else { | ||
setIsLatestVersion(true); | ||
setLoading(false); | ||
} | ||
}); | ||
}); | ||
} | ||
catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
@@ -158,0 +163,0 @@ React.useEffect(function () { |
{ | ||
"name": "react-clear-cache", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74215
401