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

react-powerhooks

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-powerhooks - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

dist/dist.de44d8ea.js

7

dist/index.es.js

@@ -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

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