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

react-update-notification

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-update-notification - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

CHANGELOG.md

2

es/index.d.ts
import { UpdateHookParams, UpdateHookReturnValue } from './types';
export declare const useUpdateCheck: ({ interval, type, }: UpdateHookParams) => UpdateHookReturnValue;
export declare const useUpdateCheck: ({ interval, type, ignoreServerCache, }: UpdateHookParams) => UpdateHookReturnValue;

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

import { useEffect, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';
import { UpdateStatus, } from './types';

@@ -6,5 +6,5 @@ var reloadPage = function () { return window.location.reload(true); };

export var useUpdateCheck = function (_a) {
var interval = _a.interval, type = _a.type;
var interval = _a.interval, type = _a.type, ignoreServerCache = _a.ignoreServerCache;
var _b = useState(UpdateStatus.checking), status = _b[0], setStatus = _b[1];
var checkUpdate = function () {
var checkUpdate = useCallback(function () {
if (typeof currentVersion === 'undefined') {

@@ -15,3 +15,7 @@ setStatus(UpdateStatus.current);

setStatus(UpdateStatus.checking);
fetch("/" + window.__APP_VERSION_FILE__)
var requestStr = "/" + window.__APP_VERSION_FILE__;
if (ignoreServerCache) {
requestStr += "?v=" + Date.now();
}
fetch(requestStr)
.then(function (res) { return res.json(); })

@@ -29,3 +33,3 @@ .then(function (data) {

});
};
}, [ignoreServerCache]);
useEffect(function () {

@@ -35,3 +39,3 @@ if (type !== 'manual') {

}
}, [type]);
}, [checkUpdate, type]);
useEffect(function () {

@@ -47,4 +51,4 @@ if (status !== UpdateStatus.current) {

}
}, [type, interval, status]);
}, [type, interval, status, checkUpdate]);
return { status: status, reloadPage: reloadPage, checkUpdate: checkUpdate };
};

@@ -13,2 +13,3 @@ declare global {

interval?: number;
ignoreServerCache?: boolean;
}

@@ -15,0 +16,0 @@ export declare enum UpdateStatus {

import { UpdateHookParams, UpdateHookReturnValue } from './types';
export declare const useUpdateCheck: ({ interval, type, }: UpdateHookParams) => UpdateHookReturnValue;
export declare const useUpdateCheck: ({ interval, type, ignoreServerCache, }: UpdateHookParams) => UpdateHookReturnValue;

@@ -8,6 +8,6 @@ "use strict";

var currentVersion = window.__APP_VERSION__;
exports.useUpdateCheck = function (_a) {
var interval = _a.interval, type = _a.type;
var useUpdateCheck = function (_a) {
var interval = _a.interval, type = _a.type, ignoreServerCache = _a.ignoreServerCache;
var _b = react_1.useState(types_1.UpdateStatus.checking), status = _b[0], setStatus = _b[1];
var checkUpdate = function () {
var checkUpdate = react_1.useCallback(function () {
if (typeof currentVersion === 'undefined') {

@@ -18,3 +18,7 @@ setStatus(types_1.UpdateStatus.current);

setStatus(types_1.UpdateStatus.checking);
fetch("/" + window.__APP_VERSION_FILE__)
var requestStr = "/" + window.__APP_VERSION_FILE__;
if (ignoreServerCache) {
requestStr += "?v=" + Date.now();
}
fetch(requestStr)
.then(function (res) { return res.json(); })

@@ -32,3 +36,3 @@ .then(function (data) {

});
};
}, [ignoreServerCache]);
react_1.useEffect(function () {

@@ -38,3 +42,3 @@ if (type !== 'manual') {

}
}, [type]);
}, [checkUpdate, type]);
react_1.useEffect(function () {

@@ -50,4 +54,5 @@ if (status !== types_1.UpdateStatus.current) {

}
}, [type, interval, status]);
}, [type, interval, status, checkUpdate]);
return { status: status, reloadPage: reloadPage, checkUpdate: checkUpdate };
};
exports.useUpdateCheck = useUpdateCheck;

@@ -13,2 +13,3 @@ declare global {

interval?: number;
ignoreServerCache?: boolean;
}

@@ -15,0 +16,0 @@ export declare enum UpdateStatus {

{
"name": "react-update-notification",
"version": "1.0.0",
"version": "1.1.0",
"description": "New version notification for your React application.",

@@ -29,13 +29,13 @@ "main": "lib/index.js",

"peerDependencies": {
"react": "^16.12.0"
"react": "^16.12.0 || ^17.0.0"
},
"devDependencies": {
"@types/react": "^16.9.48",
"@types/react": "^17.0.3",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"eslint": "^7.7.0",
"eslint-plugin-react-hooks": "^4.1.0",
"prettier": "^2.1.1",
"eslint": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"prettier": "^2.2.1",
"rimraf": "^3.0.2",
"typescript": "^4.0.2"
"typescript": "^4.2.3"
},

@@ -42,0 +42,0 @@ "dependencies": {

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