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

react-timing-hooks

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-timing-hooks - npm Package Compare versions

Comparing version 1.3.2 to 1.4.0

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

## [1.4.0](https://github.com/EricLambrecht/react-timing-hooks/compare/v1.3.2...v1.4.0) (2020-06-12)
### Features
* Add second param to useTimeoutEffect callback to manually clean the timeout ([428c3f7](https://github.com/EricLambrecht/react-timing-hooks/commit/428c3f759bb3a6e117b288c484e5cfe76e396c49))
### [1.3.2](https://github.com/EricLambrecht/react-timing-hooks/compare/v1.3.1...v1.3.2) (2020-03-28)

@@ -7,0 +14,0 @@

6

dist/index.es.js

@@ -9,3 +9,7 @@ import { useRef, useCallback, useEffect, useState } from 'react';

useEffect(() => {
return effect(timeoutFunc);
return effect(timeoutFunc, () => {
if (timeoutId.current) {
clearTimeout(timeoutId.current);
}
});
}, deps);

@@ -12,0 +16,0 @@ useEffect(() => {

@@ -13,3 +13,7 @@ 'use strict';

react.useEffect(() => {
return effect(timeoutFunc);
return effect(timeoutFunc, () => {
if (timeoutId.current) {
clearTimeout(timeoutId.current);
}
});
}, deps);

@@ -16,0 +20,0 @@ react.useEffect(() => {

2

dist/timeout/types.d.ts
export declare type TimeoutCreator = (handler: () => unknown, timeout: number) => any;
export declare type TimeoutId = ReturnType<typeof setTimeout>;
export declare type TimeoutEffectCallback = (timeoutFunc: TimeoutCreator) => void | (() => void | undefined);
export declare type TimeoutEffectCallback = (timeoutFunc: TimeoutCreator, clearFunc: () => void) => void | (() => void | undefined);
{
"name": "react-timing-hooks",
"version": "1.3.2",
"version": "1.4.0",
"description": "React hooks for setTimeout, setInterval, requestAnimationFrame, requestIdleCallback",

@@ -54,3 +54,3 @@ "main": "dist/index.js",

"cli-confirm": "^1.0.1",
"commitizen": "^4.0.3",
"commitizen": "^4.1.2",
"emoji-cz": "^0.3.1",

@@ -63,3 +63,3 @@ "jest": "^25.1.0",

"react-test-renderer": "^16.13.1",
"replace": "^1.1.5",
"replace": "^1.2.0",
"rimraf": "^3.0.2",

@@ -66,0 +66,0 @@ "rollup": "^2.1.0",

@@ -15,5 +15,3 @@ [![npm](https://flat.badgen.net/npm/v/react-timing-hooks)](https://www.npmjs.com/package/react-timing-hooks)

* `requestIdleCallback`
* Additional utility hooks like
* `useTimer`
* `useAnimationFrameLoop`
* Including "effect" versions and utility hooks like `useTimer`, `useAnimationFrameLoop`
* Full Typescript support

@@ -20,0 +18,0 @@ * [Lightweight](https://bundlephobia.com/result?p=react-timing-hooks) (less than 1KB minzipped, no external dependencies)

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