react-page-visibility
Advanced tools
Comparing version 5.1.0 to 6.0.0
@@ -7,3 +7,3 @@ import { useEffect, useState } from 'react'; | ||
function usePageVisibility() { | ||
const usePageVisibility = () => { | ||
const [initiallyVisible] = getHandlerArgs(); | ||
@@ -16,5 +16,5 @@ | ||
const handler = () => { | ||
const [currentlyVisisble] = getHandlerArgs(); | ||
const [currentlyVisible] = getHandlerArgs(); | ||
setIsVisible(currentlyVisisble); | ||
setIsVisible(currentlyVisible); | ||
}; | ||
@@ -31,4 +31,4 @@ | ||
return isVisible; | ||
} | ||
}; | ||
export default usePageVisibility; |
@@ -40,9 +40,2 @@ const hasDocument = typeof document !== 'undefined'; | ||
export const getVisibilityState = ({ hidden, state }) => { | ||
return { | ||
documentHidden: document[hidden], | ||
visibilityState: document[state] | ||
}; | ||
}; | ||
export const getHandlerArgs = () => { | ||
@@ -49,0 +42,0 @@ const { hidden, state } = visibility; |
@@ -9,3 +9,3 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
function usePageVisibility() { | ||
var usePageVisibility = function usePageVisibility() { | ||
var _getHandlerArgs = getHandlerArgs(), | ||
@@ -25,5 +25,5 @@ _getHandlerArgs2 = _slicedToArray(_getHandlerArgs, 1), | ||
_getHandlerArgs4 = _slicedToArray(_getHandlerArgs3, 1), | ||
currentlyVisisble = _getHandlerArgs4[0]; | ||
currentlyVisible = _getHandlerArgs4[0]; | ||
setIsVisible(currentlyVisisble); | ||
setIsVisible(currentlyVisible); | ||
}; | ||
@@ -40,4 +40,4 @@ | ||
return isVisible; | ||
} | ||
}; | ||
export default usePageVisibility; |
@@ -40,12 +40,2 @@ var hasDocument = typeof document !== 'undefined'; | ||
export var getVisibilityState = function getVisibilityState(_ref) { | ||
var hidden = _ref.hidden, | ||
state = _ref.state; | ||
return { | ||
documentHidden: document[hidden], | ||
visibilityState: document[state] | ||
}; | ||
}; | ||
export var getHandlerArgs = function getHandlerArgs() { | ||
@@ -52,0 +42,0 @@ var hidden = visibility.hidden, |
@@ -60,3 +60,3 @@ (function (global, factory) { | ||
function usePageVisibility() { | ||
var usePageVisibility = function usePageVisibility() { | ||
var _getHandlerArgs = (0, _utils.getHandlerArgs)(), | ||
@@ -76,5 +76,5 @@ _getHandlerArgs2 = _slicedToArray(_getHandlerArgs, 1), | ||
_getHandlerArgs4 = _slicedToArray(_getHandlerArgs3, 1), | ||
currentlyVisisble = _getHandlerArgs4[0]; | ||
currentlyVisible = _getHandlerArgs4[0]; | ||
setIsVisible(currentlyVisisble); | ||
setIsVisible(currentlyVisible); | ||
}; | ||
@@ -91,5 +91,5 @@ | ||
return isVisible; | ||
} | ||
}; | ||
exports.default = usePageVisibility; | ||
}); |
@@ -58,12 +58,2 @@ (function (global, factory) { | ||
var getVisibilityState = exports.getVisibilityState = function getVisibilityState(_ref) { | ||
var hidden = _ref.hidden, | ||
state = _ref.state; | ||
return { | ||
documentHidden: document[hidden], | ||
visibilityState: document[state] | ||
}; | ||
}; | ||
var getHandlerArgs = exports.getHandlerArgs = function getHandlerArgs() { | ||
@@ -70,0 +60,0 @@ var hidden = visibility.hidden, |
{ | ||
"name": "react-page-visibility", | ||
"version": "5.1.0", | ||
"version": "6.0.0", | ||
"description": "Declarative, nested, stateful, isomorphic page visibility for React", | ||
@@ -42,20 +42,20 @@ "author": "Gilad Peleg <gilad@giladpeleg.com> (https://www.giladpeleg.com)", | ||
"babel-cli": "^6.26.0", | ||
"babel-eslint": "^10.0.3", | ||
"babel-eslint": "^10.1.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-register": "^6.26.0", | ||
"enzyme": "^3.10.0", | ||
"enzyme-adapter-react-16": "^1.15.1", | ||
"eslint": "^6.5.1", | ||
"eslint-plugin-react": "^7.16.0", | ||
"jsdom": "^15.2.0", | ||
"prettier": "^1.18.2", | ||
"react": "^16.8.1", | ||
"react-dom": "^16.10.2", | ||
"react-test-renderer": "^16.10.2", | ||
"sinon": "^7.5.0", | ||
"tape": "^4.11.0" | ||
"enzyme": "^3.11.0", | ||
"enzyme-adapter-react-16": "^1.15.2", | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-react": "^7.19.0", | ||
"jsdom": "^16.2.2", | ||
"prettier": "^2.0.2", | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1", | ||
"react-test-renderer": "^16.13.1", | ||
"sinon": "^9.0.1", | ||
"tape": "^4.13.2" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.10.2" | ||
"react": "^16.13.1" | ||
}, | ||
@@ -62,0 +62,0 @@ "dependencies": { |
@@ -7,3 +7,3 @@ import { useEffect, useState } from 'react'; | ||
function usePageVisibility() { | ||
const usePageVisibility = () => { | ||
const [initiallyVisible] = getHandlerArgs(); | ||
@@ -16,5 +16,5 @@ | ||
const handler = () => { | ||
const [currentlyVisisble] = getHandlerArgs(); | ||
const [currentlyVisible] = getHandlerArgs(); | ||
setIsVisible(currentlyVisisble); | ||
setIsVisible(currentlyVisible); | ||
}; | ||
@@ -31,4 +31,4 @@ | ||
return isVisible; | ||
} | ||
}; | ||
export default usePageVisibility; |
@@ -46,9 +46,2 @@ const hasDocument = typeof document !== 'undefined'; | ||
export const getVisibilityState = ({ hidden, state }) => { | ||
return { | ||
documentHidden: document[hidden], | ||
visibilityState: document[state], | ||
}; | ||
}; | ||
export const getHandlerArgs = () => { | ||
@@ -55,0 +48,0 @@ const { hidden, state } = visibility; |
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
34174
691