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 0.1.1 to 0.1.2

7

CHANGELOG.md

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

### [0.1.2](https://github.com/EricLambrecht/react-timing-hooks/compare/v0.1.1...v0.1.2) (2019-11-08)
### Bug Fixes
* Fix example in documentation ([44b0713](https://github.com/EricLambrecht/react-timing-hooks/commit/44b0713cc42cdae41d3fadf41e7ae45bf8291580))
### [0.1.1](https://github.com/EricLambrecht/react-timing-hooks/compare/v0.1.0...v0.1.1) (2019-11-08)

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

4

dist/animation-frame/types.d.ts

@@ -1,3 +0,1 @@

export declare type AnimationFrameHandle = ReturnType<
typeof requestAnimationFrame
>
export declare type AnimationFrameHandle = ReturnType<typeof requestAnimationFrame>;

@@ -1,8 +0,6 @@

import { Callback } from '../types'
import { Callback } from '../types';
/**
* @param callback The callback that is invoked in the next animation frame
*/
declare const useAnimationFrame: (
callback: Callback
) => (...args: unknown[]) => void
export default useAnimationFrame
declare const useAnimationFrame: (callback: Callback) => (...args: unknown[]) => void;
export default useAnimationFrame;

@@ -1,3 +0,3 @@

import { Callback } from '../types'
declare const useAnimationFrameLoop: (callback: Callback) => void
export default useAnimationFrameLoop
import { Callback } from '../types';
declare const useAnimationFrameLoop: (callback: Callback) => void;
export default useAnimationFrameLoop;

@@ -1,15 +0,10 @@

export declare type IdleCallbackCreator = (
callback: (deadline: RequestIdleCallbackDeadline) => unknown,
options?: RequestIdleCallbackOptions
) => RequestIdleCallbackHandle
export declare type IdleCallbackEffectCallback = (
requestIdleCallback: IdleCallbackCreator
) => void | (() => void | undefined)
export declare type RequestIdleCallbackHandle = number
export declare type IdleCallbackCreator = (callback: (deadline: RequestIdleCallbackDeadline) => unknown, options?: RequestIdleCallbackOptions) => RequestIdleCallbackHandle;
export declare type IdleCallbackEffectCallback = (requestIdleCallback: IdleCallbackCreator) => void | (() => void | undefined);
export declare type RequestIdleCallbackHandle = number;
export declare type RequestIdleCallbackOptions = {
timeout: number
}
timeout: number;
};
export declare type RequestIdleCallbackDeadline = {
readonly didTimeout: boolean
timeRemaining: () => number
}
readonly didTimeout: boolean;
timeRemaining: () => number;
};

@@ -1,15 +0,8 @@

import {
RequestIdleCallbackDeadline,
RequestIdleCallbackHandle,
RequestIdleCallbackOptions,
} from './types'
import { Callback } from '../types'
import { RequestIdleCallbackDeadline, RequestIdleCallbackHandle, RequestIdleCallbackOptions } from './types';
import { Callback } from '../types';
declare global {
interface Window {
requestIdleCallback: (
callback: (deadline: RequestIdleCallbackDeadline) => unknown,
options?: RequestIdleCallbackOptions
) => RequestIdleCallbackHandle
cancelIdleCallback: (handle: RequestIdleCallbackHandle) => void
}
interface Window {
requestIdleCallback: (callback: (deadline: RequestIdleCallbackDeadline) => unknown, options?: RequestIdleCallbackOptions) => RequestIdleCallbackHandle;
cancelIdleCallback: (handle: RequestIdleCallbackHandle) => void;
}
}

@@ -20,6 +13,3 @@ /**

*/
declare const useIdleCallback: (
callback: Callback,
options?: RequestIdleCallbackOptions | undefined
) => Callback
export default useIdleCallback
declare const useIdleCallback: (callback: Callback, options?: RequestIdleCallbackOptions | undefined) => Callback;
export default useIdleCallback;

@@ -1,20 +0,9 @@

import {
RequestIdleCallbackHandle,
IdleCallbackEffectCallback,
RequestIdleCallbackDeadline,
RequestIdleCallbackOptions,
} from './types'
import { RequestIdleCallbackHandle, IdleCallbackEffectCallback, RequestIdleCallbackDeadline, RequestIdleCallbackOptions } from './types';
declare global {
interface Window {
requestIdleCallback: (
callback: (deadline: RequestIdleCallbackDeadline) => unknown,
options?: RequestIdleCallbackOptions
) => RequestIdleCallbackHandle
cancelIdleCallback: (handle: RequestIdleCallbackHandle) => void
}
interface Window {
requestIdleCallback: (callback: (deadline: RequestIdleCallbackDeadline) => unknown, options?: RequestIdleCallbackOptions) => RequestIdleCallbackHandle;
cancelIdleCallback: (handle: RequestIdleCallbackHandle) => void;
}
}
declare const useIdleCallbackEffect: (
effect: IdleCallbackEffectCallback,
deps: readonly any[]
) => void
export default useIdleCallbackEffect
declare const useIdleCallbackEffect: (effect: IdleCallbackEffectCallback, deps: readonly any[]) => void;
export default useIdleCallbackEffect;

@@ -1,24 +0,12 @@

import useTimeoutEffect from './timeout/useTimeoutEffect'
import useTimeout from './timeout/useTimeout'
import useInterval from './interval/useInterval'
import useIdleCallbackEffect from './idle-callback/useIdleCallbackEffect'
import useIdleCallback from './idle-callback/useIdleCallback'
import useAnimationFrame from './animation-frame/useAnimationFrame'
import useAnimationFrameLoop from './animation-frame/useAnimationFrameLoop'
import { IntervalCallback } from './interval/types'
import { TimeoutEffectCallback } from './timeout/types'
import { IdleCallbackEffectCallback } from './idle-callback/types'
import { Callback } from './types'
export {
useAnimationFrame,
useAnimationFrameLoop,
useIdleCallback,
useIdleCallbackEffect,
useInterval,
useTimeout,
useTimeoutEffect,
IdleCallbackEffectCallback,
IntervalCallback,
TimeoutEffectCallback,
Callback,
}
import useTimeoutEffect from './timeout/useTimeoutEffect';
import useTimeout from './timeout/useTimeout';
import useInterval from './interval/useInterval';
import useIdleCallbackEffect from './idle-callback/useIdleCallbackEffect';
import useIdleCallback from './idle-callback/useIdleCallback';
import useAnimationFrame from './animation-frame/useAnimationFrame';
import useAnimationFrameLoop from './animation-frame/useAnimationFrameLoop';
import { IntervalCallback } from './interval/types';
import { TimeoutEffectCallback } from './timeout/types';
import { IdleCallbackEffectCallback } from './idle-callback/types';
import { Callback } from './types';
export { useAnimationFrame, useAnimationFrameLoop, useIdleCallback, useIdleCallbackEffect, useInterval, useTimeout, useTimeoutEffect, IdleCallbackEffectCallback, IntervalCallback, TimeoutEffectCallback, Callback, };

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

export declare type IntervalCallback = () => unknown
export declare type IntervalCallback = () => unknown;

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

import { IntervalCallback } from './types'
import { IntervalCallback } from './types';
/**

@@ -9,6 +9,3 @@ * This hook was inspired by Dan Abramov's blogpost:

*/
declare const useInterval: (
callback: IntervalCallback,
delay: number | null
) => void
export default useInterval
declare const useInterval: (callback: IntervalCallback, delay: number | null) => void;
export default useInterval;

@@ -1,9 +0,4 @@

export declare type TimeoutCreator = (
handler: () => unknown,
timeout: number
) => any
export declare type TimeoutId = ReturnType<typeof setTimeout>
export declare type TimeoutCallback = (...args: any[]) => unknown
export declare type TimeoutEffectCallback = (
timeoutFunc: TimeoutCreator
) => void | (() => void | undefined)
export declare type TimeoutCreator = (handler: () => unknown, timeout: number) => any;
export declare type TimeoutId = ReturnType<typeof setTimeout>;
export declare type TimeoutCallback = (...args: any[]) => unknown;
export declare type TimeoutEffectCallback = (timeoutFunc: TimeoutCreator) => void | (() => void | undefined);

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

import { TimeoutCallback } from './types'
import { TimeoutCallback } from './types';
/**

@@ -6,6 +6,3 @@ * @param callback The callback that is invoked after the timeout expired

*/
declare const useTimeout: (
callback: TimeoutCallback,
timeout: number
) => (...args: unknown[]) => void
export default useTimeout
declare const useTimeout: (callback: TimeoutCallback, timeout: number) => (...args: unknown[]) => void;
export default useTimeout;

@@ -1,6 +0,3 @@

import { TimeoutEffectCallback } from './types'
declare const useTimeoutEffect: (
effect: TimeoutEffectCallback,
deps: readonly any[]
) => void
export default useTimeoutEffect
import { TimeoutEffectCallback } from './types';
declare const useTimeoutEffect: (effect: TimeoutEffectCallback, deps: readonly any[]) => void;
export default useTimeoutEffect;

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

export declare type Callback = (...args: any[]) => unknown
export declare type Callback = (...args: any[]) => unknown;
{
"name": "react-timing-hooks",
"version": "0.1.1",
"description": "React hooks for creating timing-related effects (setTimeout, setInterval, requestAnimationFrame, requestIdleCallback)",
"version": "0.1.2",
"description": "React hooks for setTimeout, setInterval, requestAnimationFrame, requestIdleCallback",
"main": "dist/index.js",

@@ -6,0 +6,0 @@ "types": "dist/index.d.ts",

@@ -44,2 +44,4 @@ # react-timing-hooks

------
### `useTimeoutEffect(effectCallback, deps)`

@@ -66,2 +68,4 @@

------
### `useInterval(intervalCallback, delay)`

@@ -81,2 +85,4 @@

------
### `useAnimationFrame(callback)`

@@ -86,2 +92,3 @@

------

@@ -102,2 +109,3 @@ ### `useAnimationFrameLoop(callback)`

------

@@ -119,2 +127,4 @@ ### `useIdleCallback(callback, options)`

------
### `useIdleCallbackEffect(effectCallback, deps)`

@@ -182,3 +192,3 @@

// ...
useEffect((timeout) => {
useTimeoutEffect((timeout) => {
if (depA && depB) {

@@ -185,0 +195,0 @@ timeout(() => doSomething(), 1000)

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