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.4.12 to 1.4.13

9

dist/index.es.js

@@ -1,2 +0,2 @@

import { useRef, useEffect, useState, createContext, createElement, useContext } from 'react';
import { useRef, useEffect, useState, useCallback, createContext, createElement, useContext } from 'react';

@@ -81,5 +81,4 @@ /*! *****************************************************************************

var u={},c=function(t,n,e){return u[t]||(u[t]={callbacks:[],value:e}),u[t].callbacks.push(n),{deregister:function(){var e=u[t].callbacks,r$$1=e.indexOf(n);r$$1>-1&&e.splice(r$$1,1);},emit:function(e){u[t].value!==e&&(u[t].value=e,u[t].callbacks.forEach(function(t){n!==t&&t(e);}));}}};function createPersistedState(u,i){if(void 0===i&&(i=global.localStorage),i){var o=function(t){return {get:function(n,e){var r$$1=t.getItem(n);return null===r$$1?"function"==typeof e?e():e:JSON.parse(r$$1)},set:function(n,e){t.setItem(n,JSON.stringify(e));}}}(i);return function(i){return function(u,i,o){var a=o.get,f=o.set,l=useRef(null),s=useState(function(){return a(i,u)}),v=s[0],g=s[1];return r("storage",function(t){var n=t.key,e=JSON.parse(t.newValue);n===i&&v!==e&&g(e);}),useEffect(function(){return l.current=c(i,g,u),function(){l.current.deregister();}},[]),useEffect(function(){f(i,v),l.current.emit(v);},[v]),[v,g]}(i,u,o)}}return useState}
var l={},a=function(e,n,t){return l[e]||(l[e]={callbacks:[],value:t}),l[e].callbacks.push(n),{deregister:function(){var t=l[e].callbacks,o=t.indexOf(n);o>-1&&t.splice(o,1);},emit:function(t){l[e].value!==t&&(l[e].value=t,l[e].callbacks.forEach(function(e){n!==e&&e(t);}));}}};function createPersistedState(l,u){if(void 0===u&&(u="undefined"!=typeof global&&global.localStorage?global.localStorage:"undefined"!=typeof globalThis&&globalThis.localStorage?globalThis.localStorage:"undefined"!=typeof window&&window.localStorage?window.localStorage:"undefined"!=typeof localStorage?localStorage:null),u){var i=function(e){return {get:function(n,t){var o=e.getItem(n);return null==o?"function"==typeof t?t():t:JSON.parse(o)},set:function(n,t){e.setItem(n,JSON.stringify(t));}}}(u);return function(u){return function(l,u,i){var c=i.get,f=i.set,g=useRef(null),s=useState(function(){return c(u,l)}),d=s[0],p=s[1];r("storage",function(e){if(e.key===u){var n=JSON.parse(e.newValue);d!==n&&p(n);}}),useEffect(function(){return g.current=a(u,p,l),function(){g.current.deregister();}},[l,u]);var v=useCallback(function(e){var n="function"==typeof e?e(d):e;f(u,n),p(n),g.current.emit(e);},[d,f,u]);return [d,v]}(u,l,i)}}return useState}
var _this = undefined;
var STORAGE_KEY = 'APP_VERSION';

@@ -102,3 +101,3 @@ var defaultProps = {

var useClearCache = function (props) {
var _a = __assign({}, defaultProps, props), duration = _a.duration, auto = _a.auto, storageKey = _a.storageKey, basePath = _a.basePath, filename = _a.filename;
var _a = __assign(__assign({}, defaultProps), props), duration = _a.duration, auto = _a.auto, storageKey = _a.storageKey, basePath = _a.basePath, filename = _a.filename;
var _b = useState(true), loading = _b[0], setLoading = _b[1];

@@ -121,3 +120,3 @@ var useAppVersionState = createPersistedState(storageKey);

}
var emptyCacheStorage = function (version) { return __awaiter(_this, void 0, void 0, function () {
var emptyCacheStorage = function (version) { return __awaiter(void 0, void 0, void 0, function () {
var cacheKeys;

@@ -124,0 +123,0 @@ return __generator(this, function (_a) {

@@ -85,5 +85,4 @@ 'use strict';

var u={},c=function(t,n,e){return u[t]||(u[t]={callbacks:[],value:e}),u[t].callbacks.push(n),{deregister:function(){var e=u[t].callbacks,r$$1=e.indexOf(n);r$$1>-1&&e.splice(r$$1,1);},emit:function(e){u[t].value!==e&&(u[t].value=e,u[t].callbacks.forEach(function(t){n!==t&&t(e);}));}}};function createPersistedState(u,i){if(void 0===i&&(i=global.localStorage),i){var o=function(t){return {get:function(n,e){var r$$1=t.getItem(n);return null===r$$1?"function"==typeof e?e():e:JSON.parse(r$$1)},set:function(n,e){t.setItem(n,JSON.stringify(e));}}}(i);return function(i){return function(u,i,o){var a=o.get,f=o.set,l=React.useRef(null),s=React.useState(function(){return a(i,u)}),v=s[0],g=s[1];return r("storage",function(t){var n=t.key,e=JSON.parse(t.newValue);n===i&&v!==e&&g(e);}),React.useEffect(function(){return l.current=c(i,g,u),function(){l.current.deregister();}},[]),React.useEffect(function(){f(i,v),l.current.emit(v);},[v]),[v,g]}(i,u,o)}}return React.useState}
var l={},a=function(e,n,t){return l[e]||(l[e]={callbacks:[],value:t}),l[e].callbacks.push(n),{deregister:function(){var t=l[e].callbacks,o=t.indexOf(n);o>-1&&t.splice(o,1);},emit:function(t){l[e].value!==t&&(l[e].value=t,l[e].callbacks.forEach(function(e){n!==e&&e(t);}));}}};function createPersistedState(l,u){if(void 0===u&&(u="undefined"!=typeof global&&global.localStorage?global.localStorage:"undefined"!=typeof globalThis&&globalThis.localStorage?globalThis.localStorage:"undefined"!=typeof window&&window.localStorage?window.localStorage:"undefined"!=typeof localStorage?localStorage:null),u){var i=function(e){return {get:function(n,t){var o=e.getItem(n);return null==o?"function"==typeof t?t():t:JSON.parse(o)},set:function(n,t){e.setItem(n,JSON.stringify(t));}}}(u);return function(u){return function(l,u,i){var c=i.get,f=i.set,g=React.useRef(null),s=React.useState(function(){return c(u,l)}),d=s[0],p=s[1];r("storage",function(e){if(e.key===u){var n=JSON.parse(e.newValue);d!==n&&p(n);}}),React.useEffect(function(){return g.current=a(u,p,l),function(){g.current.deregister();}},[l,u]);var v=React.useCallback(function(e){var n="function"==typeof e?e(d):e;f(u,n),p(n),g.current.emit(e);},[d,f,u]);return [d,v]}(u,l,i)}}return React.useState}
var _this = undefined;
var STORAGE_KEY = 'APP_VERSION';

@@ -106,3 +105,3 @@ var defaultProps = {

var useClearCache = function (props) {
var _a = __assign({}, defaultProps, props), duration = _a.duration, auto = _a.auto, storageKey = _a.storageKey, basePath = _a.basePath, filename = _a.filename;
var _a = __assign(__assign({}, defaultProps), props), duration = _a.duration, auto = _a.auto, storageKey = _a.storageKey, basePath = _a.basePath, filename = _a.filename;
var _b = React.useState(true), loading = _b[0], setLoading = _b[1];

@@ -125,3 +124,3 @@ var useAppVersionState = createPersistedState(storageKey);

}
var emptyCacheStorage = function (version) { return __awaiter(_this, void 0, void 0, function () {
var emptyCacheStorage = function (version) { return __awaiter(void 0, void 0, void 0, function () {
var cacheKeys;

@@ -128,0 +127,0 @@ return __generator(this, function (_a) {

{
"name": "react-clear-cache",
"version": "1.4.12",
"version": "1.4.13",
"description": "A component to manage application updates.",

@@ -5,0 +5,0 @@ "author": "noahjohn9259",

@@ -7,2 +7,4 @@ # react-clear-cache

[![Rate this package](https://badges.openbase.com/js/rating/react-clear-cache.svg?token=wqFZAY/V6KcfoKNmFEUlKWwXKAqWXg9RRKz2eE8fXqg=)](https://openbase.com/js/react-clear-cache?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)
## Demo

@@ -165,7 +167,7 @@

1. [noahjohn9259](https://github.com/noahjohn9259)
1. [geminstall23](https://github.com/geminstall23)
## License
MIT © [noahjohn9259](https://github.com/noahjohn9259)
MIT © [geminstall23](https://github.com/geminstall23)

@@ -172,0 +174,0 @@ ## Development

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