react-powerhooks
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -91,3 +91,4 @@ import { useState, useCallback, useEffect } from 'react'; | ||
var startImmediate = _ref.startImmediate, | ||
time = _ref.time; | ||
time = _ref.time, | ||
cb = _ref.cb; | ||
@@ -112,3 +113,4 @@ var _useState = useState(0), | ||
var _intervalId = setInterval(function () { | ||
return updateCount(count + 1); | ||
updateCount(count + 1); | ||
cb(); | ||
}, time); | ||
@@ -126,3 +128,2 @@ setIntervalId(_intervalId); | ||
return { | ||
intervalId: intervalId, | ||
start: useCallback(function () { | ||
@@ -129,0 +130,0 @@ setIntervalState(true); |
@@ -95,3 +95,4 @@ 'use strict'; | ||
var startImmediate = _ref.startImmediate, | ||
time = _ref.time; | ||
time = _ref.time, | ||
cb = _ref.cb; | ||
@@ -116,3 +117,4 @@ var _useState = react.useState(0), | ||
var _intervalId = setInterval(function () { | ||
return updateCount(count + 1); | ||
updateCount(count + 1); | ||
cb(); | ||
}, time); | ||
@@ -130,3 +132,2 @@ setIntervalId(_intervalId); | ||
return { | ||
intervalId: intervalId, | ||
start: react.useCallback(function () { | ||
@@ -133,0 +134,0 @@ setIntervalState(true); |
{ | ||
"name": "react-powerhooks", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Hooks api for common powerplugs", | ||
@@ -19,8 +19,6 @@ "author": "pkodmad", | ||
"start": "rollup -c -w", | ||
"prepare": "yarn run build", | ||
"predeploy": "cd example && yarn install && yarn run build" | ||
"example": "parcel example.html" | ||
}, | ||
"peerDependencies": { | ||
"react": "16.7.0-alpha.0", | ||
"react-dom": "16.7.0-alpha.0" | ||
"dependencies": { | ||
"react": "^16.7.0-alpha.0" | ||
}, | ||
@@ -43,3 +41,5 @@ "devDependencies": { | ||
"eslint-plugin-standard": "^3.1.0", | ||
"parcel": "^1.10.3", | ||
"react-scripts": "^1.1.4", | ||
"react-dom": "16.7.0-alpha.0", | ||
"react-testing-library": "^5.2.3", | ||
@@ -46,0 +46,0 @@ "rollup": "^0.64.1", |
@@ -62,3 +62,18 @@ <div align="center"> | ||
```jsx | ||
const { start, stop } = useInterval({ time, startImmediate }); | ||
const [time, setTime] = useState(null); | ||
const { start, stop } = useInterval({ | ||
duration: 1000, | ||
startImmediate: false, | ||
callback: () => { | ||
setTime(new Date().toLocaleTimeString()); | ||
} | ||
}); | ||
return ( | ||
<Fragment> | ||
<div>The time is now {time}</div> | ||
<button onClick={() => stop()}>Stop interval</button> | ||
<button onClick={() => start()}>Start interval</button> | ||
</Fragment> | ||
); | ||
``` |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
2864603
1
13
24836
79
26
4
4
+ Addedreact@^16.7.0-alpha.0
+ Addedreact@16.14.0(transitive)
- Removedreact@16.7.0-alpha.0(transitive)
- Removedreact-dom@16.7.0-alpha.0(transitive)
- Removedscheduler@0.11.3(transitive)