New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@khanacademy/wonder-blocks-timing

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@khanacademy/wonder-blocks-timing - npm Package Compare versions

Comparing version 0.0.0-PR2222-20240504010027 to 0.0.0-PR2222-20240508211345

2

CHANGELOG.md
# @khanacademy/wonder-blocks-timing
## 0.0.0-PR2222-20240504010027
## 0.0.0-PR2222-20240508211345

@@ -5,0 +5,0 @@ ### Major Changes

@@ -6,8 +6,8 @@ import type { IInterval, HookOptions } from "../util/types";

* @param action The action to be invoked each time the interval period has
* passed. By default, this will not cause the interval to restart. This makes
* it easier to use with inline lambda functions rather than requiring
* consumers to wrap their action in a `useCallback`. To change this behavior,
* see the `actionPolicy` option.
* passed. By default, this will not cause the interval to restart if it
* changes. This makes it easier to use with inline lambda functions rather than
* requiring consumers to wrap their action in a `useCallback`. To change this
* behavior, see the `actionPolicy` option.
* @param intervalMs The interval period. If this changes, the interval will
* be reset.
* be reset per the `schedulePolicy` option.
* @param options Options for the hook.

@@ -18,11 +18,11 @@ * @param options.actionPolicy Determines how the action is handled when it

* If you want to reset the interval when the action changes, use
* "replace-and-reset".
* `ActionPolicy.Reset`.
* @param options.clearPolicy Determines how the interval is cleared when the
* component is unmounted or the interval is recreated. By default, the
* interval is cleared immediately. If you want to let the interval run to
* completion, use "resolve-on-clear". This is NOT applied if the interval
* completion, use `ClearPolicy.Resolve`. This is NOT applied if the interval
* is cleared manually via the `clear()` method on the returned API.
* @param options.schedulePolicy Determines when the interval is scheduled.
* By default, the interval is scheduled immediately. If you want to delay
* scheduling the interval, use "schedule-on-demand".
* scheduling the interval, use `SchedulePolicy.OnDemand`.
* @returns An `IInterval` API for interacting with the given interval. This

@@ -29,0 +29,0 @@ * API is a no-op if called when not mounted. This means that any calls prior

import type { ITimeout, HookOptions } from "../util/types";
/**
* Hook providing access to a scheduled timeout.
*
* @param action The action to be invoked when the timeout period has
* passed. By default, this will not cause the timeout to restart if it changes.
* This makes it easier to use with inline lambda functions rather than
* requiring consumers to wrap their action in a `useCallback`. To change
* this behavior, see the `actionPolicy` option.
* @param timeoutMs The timeout period. If this changes, the timeout will
* be reset per the `schedulePolicy` option.
* @param options Options for the hook.
* @param options.actionPolicy Determines how the action is handled when it
* changes. By default, the action is replaced but the timeout is not reset,
* and the updated action will be invoked when the timeout next fires.
* If you want to reset the timeout when the action changes, use
* `ActionPolicy.Reset`.
* @param options.clearPolicy Determines how the timeout is cleared when the
* component is unmounted or the timeout is recreated. By default, the
* timeout is cleared immediately. If you want to let the timeout run to
* completion, use `ClearPolicy.Resolve`. This is NOT applied if the timeout
* is cleared manually via the `clear()` method on the returned API.
* @param options.schedulePolicy Determines when the timeout is scheduled.
* By default, the timeout is scheduled immediately. If you want to delay
* scheduling the timeout, use `SchedulePolicy.OnDemand`.
* @returns An `ITimeout` API for interacting with the given timeout. This
* API is a no-op if called when not mounted. This means that any calls prior
* to mounting or after unmounting will not have any effect.
*/
export declare function useTimeout(action: () => unknown, timeoutMs: number, options?: HookOptions): ITimeout;
{
"name": "@khanacademy/wonder-blocks-timing",
"private": false,
"version": "0.0.0-PR2222-20240504010027",
"version": "0.0.0-PR2222-20240508211345",
"design": "v1",

@@ -6,0 +6,0 @@ "publishConfig": {

@@ -62,2 +62,3 @@ import {renderHook, act} from "@testing-library/react-hooks";

it("should call the action before unmounting", () => {
// Arrange
const action = jest.fn();

@@ -70,2 +71,3 @@ const {unmount} = renderHook(() =>

// Act
act(() => {

@@ -75,2 +77,3 @@ unmount();

// Assert
expect(action).toHaveBeenCalled();

@@ -77,0 +80,0 @@ });

@@ -12,8 +12,8 @@ import {useEffect, useMemo, useRef} from "react";

* @param action The action to be invoked each time the interval period has
* passed. By default, this will not cause the interval to restart. This makes
* it easier to use with inline lambda functions rather than requiring
* consumers to wrap their action in a `useCallback`. To change this behavior,
* see the `actionPolicy` option.
* passed. By default, this will not cause the interval to restart if it
* changes. This makes it easier to use with inline lambda functions rather than
* requiring consumers to wrap their action in a `useCallback`. To change this
* behavior, see the `actionPolicy` option.
* @param intervalMs The interval period. If this changes, the interval will
* be reset.
* be reset per the `schedulePolicy` option.
* @param options Options for the hook.

@@ -24,11 +24,11 @@ * @param options.actionPolicy Determines how the action is handled when it

* If you want to reset the interval when the action changes, use
* "replace-and-reset".
* `ActionPolicy.Reset`.
* @param options.clearPolicy Determines how the interval is cleared when the
* component is unmounted or the interval is recreated. By default, the
* interval is cleared immediately. If you want to let the interval run to
* completion, use "resolve-on-clear". This is NOT applied if the interval
* completion, use `ClearPolicy.Resolve`. This is NOT applied if the interval
* is cleared manually via the `clear()` method on the returned API.
* @param options.schedulePolicy Determines when the interval is scheduled.
* By default, the interval is scheduled immediately. If you want to delay
* scheduling the interval, use "schedule-on-demand".
* scheduling the interval, use `SchedulePolicy.OnDemand`.
* @returns An `IInterval` API for interacting with the given interval. This

@@ -35,0 +35,0 @@ * API is a no-op if called when not mounted. This means that any calls prior

@@ -8,2 +8,30 @@ import {useEffect, useMemo, useRef} from "react";

/**
* Hook providing access to a scheduled timeout.
*
* @param action The action to be invoked when the timeout period has
* passed. By default, this will not cause the timeout to restart if it changes.
* This makes it easier to use with inline lambda functions rather than
* requiring consumers to wrap their action in a `useCallback`. To change
* this behavior, see the `actionPolicy` option.
* @param timeoutMs The timeout period. If this changes, the timeout will
* be reset per the `schedulePolicy` option.
* @param options Options for the hook.
* @param options.actionPolicy Determines how the action is handled when it
* changes. By default, the action is replaced but the timeout is not reset,
* and the updated action will be invoked when the timeout next fires.
* If you want to reset the timeout when the action changes, use
* `ActionPolicy.Reset`.
* @param options.clearPolicy Determines how the timeout is cleared when the
* component is unmounted or the timeout is recreated. By default, the
* timeout is cleared immediately. If you want to let the timeout run to
* completion, use `ClearPolicy.Resolve`. This is NOT applied if the timeout
* is cleared manually via the `clear()` method on the returned API.
* @param options.schedulePolicy Determines when the timeout is scheduled.
* By default, the timeout is scheduled immediately. If you want to delay
* scheduling the timeout, use `SchedulePolicy.OnDemand`.
* @returns An `ITimeout` API for interacting with the given timeout. This
* API is a no-op if called when not mounted. This means that any calls prior
* to mounting or after unmounting will not have any effect.
*/
export function useTimeout(

@@ -10,0 +38,0 @@ action: () => unknown,

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