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-PR2414-20241220221259 to 0.0.0-PR2453-20250204180605

LICENSE

83

CHANGELOG.md
# @khanacademy/wonder-blocks-timing
## 0.0.0-PR2414-20241220221259
## 0.0.0-PR2453-20250204180605
### Minor Changes
- 1035bf3: Tooling:
- Switching to `pnpm`.
- Upgrading `rollup` to v4 and `@babel/runtime` to match the current webapp version.
## 6.0.1
### Patch Changes
- 11a0f5c6: No functional changes. Adding prepublishOnly script.
- 11a0f5c6: No functional changes. Adding prepublishOnly script.

@@ -13,3 +22,3 @@ ## 6.0.0

- e6abdd17: Upgrade to React 18
- e6abdd17: Upgrade to React 18

@@ -20,3 +29,3 @@ ## 5.0.2

- 02a1b298: Make sure we don't package tsconfig and tsbuildinfo files
- 02a1b298: Make sure we don't package tsconfig and tsbuildinfo files

@@ -27,3 +36,3 @@ ## 5.0.1

- 559e82d5: Update to build tooling, generating smaller output
- 559e82d5: Update to build tooling, generating smaller output

@@ -34,9 +43,9 @@ ## 5.0.0

- f72f7dd4: - **[BREAKING CHANGE]** Policy types are now using enums across all APIs
- **[BREAKING CHANGE]** `useScheduledTimeout` has been renamed to `useTimeout` and the original `useTimeout` has been removed. To update existing uses of `useTimeout` to the new API: if `active` was `true` just delete that argument or replace it with `{schedulingPolicy: SchedulingPolicy.Immediately}`; if `active` was `false` replace it with `{schedulingPolicy: SchedulingPolicy.OnDemand}`.
- **[BREAKING CHANGE]** `useScheduledInterval` has been renamed to `useInterval` and the original `useInterval` has been removed. To update existing uses of `useInterval` to the new API: if `active` was `true` just delete that argument or replace it with `{schedulingPolicy: SchedulingPolicy.Immediately}`; if `active` was `false` replace it with `{schedulingPolicy: SchedulingPolicy.OnDemand}`.
- **[NEW]** `useTimeout` now supports an optional `ActionPolicy` in the options. The default is to not reset the timeout when the `action` callback changes. This can be changed to `ActionPolicy.Reset` to reset the timeout when the `action` callback changes (it is recommended that you use `useCallback` on your `action` callback to avoid resetting the timeout everytime a component renders when using the `Reset` policy).
- **[NEW]** `useInterval` now supports an optional `ActionPolicy` in the options. The default is to not reset the interval when the `action` callback changes. This can be changed to `ActionPolicy.Reset` to reset the interval when the `action` callback changes (it is recommended that you use `useCallback` on your `action` callback to avoid resetting the interval everytime a component renders when using the `Reset` policy).
- **[BUGFIX]** `useTimeout` will now correctly reset the timeout when the `set` method is called, as intended.
- **[BUGFIX]** `useInterval` will now correctly reset the interval when the `set` method is called, as intended.
- f72f7dd4: - **[BREAKING CHANGE]** Policy types are now using enums across all APIs
- **[BREAKING CHANGE]** `useScheduledTimeout` has been renamed to `useTimeout` and the original `useTimeout` has been removed. To update existing uses of `useTimeout` to the new API: if `active` was `true` just delete that argument or replace it with `{schedulingPolicy: SchedulingPolicy.Immediately}`; if `active` was `false` replace it with `{schedulingPolicy: SchedulingPolicy.OnDemand}`.
- **[BREAKING CHANGE]** `useScheduledInterval` has been renamed to `useInterval` and the original `useInterval` has been removed. To update existing uses of `useInterval` to the new API: if `active` was `true` just delete that argument or replace it with `{schedulingPolicy: SchedulingPolicy.Immediately}`; if `active` was `false` replace it with `{schedulingPolicy: SchedulingPolicy.OnDemand}`.
- **[NEW]** `useTimeout` now supports an optional `ActionPolicy` in the options. The default is to not reset the timeout when the `action` callback changes. This can be changed to `ActionPolicy.Reset` to reset the timeout when the `action` callback changes (it is recommended that you use `useCallback` on your `action` callback to avoid resetting the timeout everytime a component renders when using the `Reset` policy).
- **[NEW]** `useInterval` now supports an optional `ActionPolicy` in the options. The default is to not reset the interval when the `action` callback changes. This can be changed to `ActionPolicy.Reset` to reset the interval when the `action` callback changes (it is recommended that you use `useCallback` on your `action` callback to avoid resetting the interval everytime a component renders when using the `Reset` policy).
- **[BUGFIX]** `useTimeout` will now correctly reset the timeout when the `set` method is called, as intended.
- **[BUGFIX]** `useInterval` will now correctly reset the interval when the `set` method is called, as intended.

@@ -47,3 +56,3 @@ ## 4.0.2

- 695f2567: Provide a friendly name (for dev tools) for withActionScheduler
- 695f2567: Provide a friendly name (for dev tools) for withActionScheduler

@@ -54,3 +63,3 @@ ## 4.0.1

- df9a10aa: Update state and props to be readonly in components using getDerivedStateFromProps()
- df9a10aa: Update state and props to be readonly in components using getDerivedStateFromProps()

@@ -61,3 +70,3 @@ ## 4.0.0

- 0c2607e6: Remove ref-forwarding from withActionScheduler
- 0c2607e6: Remove ref-forwarding from withActionScheduler

@@ -68,3 +77,3 @@ ## 3.0.3

- a6164ed0: Don't use React.FC<> for functional components
- a6164ed0: Don't use React.FC<> for functional components

@@ -75,3 +84,3 @@ ## 3.0.2

- c20f48f3: Don't transpile classes when building bundles
- c20f48f3: Don't transpile classes when building bundles

@@ -82,4 +91,4 @@ ## 3.0.1

- ccb6fe00: Miscellaneous TS type fixes
- d4c2b18c: Fix a variety of issues with Flow types generated by flowgen
- ccb6fe00: Miscellaneous TS type fixes
- d4c2b18c: Fix a variety of issues with Flow types generated by flowgen

@@ -90,7 +99,7 @@ ## 3.0.0

- 1ca4d7e3: Fix minor issue with generate Flow types (this is a major bump b/c I forgot to do one after doing the TS conversion)
- 1ca4d7e3: Fix minor issue with generate Flow types (this is a major bump b/c I forgot to do one after doing the TS conversion)
### Minor Changes
- ef661acf: Export ActionScheduler
- ef661acf: Export ActionScheduler

@@ -101,3 +110,3 @@ ## 2.1.3

- b5ba5568: Ensure that flow lib defs use React.ElementConfig<> isntead of JSX.LibraryManagedAttributes<>
- b5ba5568: Ensure that flow lib defs use React.ElementConfig<> isntead of JSX.LibraryManagedAttributes<>

@@ -108,10 +117,10 @@ ## 2.1.2

- d816af08: Update build and test configs use TypeScript
- 3891f544: Update babel config to include plugins that Storybook needed
- 0d28bb1c: Configured TypeScript
- 3d05f764: Fix HOCs and other type errors
- c2ec4902: Update eslint configuration, fix lint
- 2983c05b: Include 'types' field in package.json
- 77ff6a66: Generate Flow types from TypeScript types
- ec8d4b7f: Fix miscellaneous TypeScript errors
- d816af08: Update build and test configs use TypeScript
- 3891f544: Update babel config to include plugins that Storybook needed
- 0d28bb1c: Configured TypeScript
- 3d05f764: Fix HOCs and other type errors
- c2ec4902: Update eslint configuration, fix lint
- 2983c05b: Include 'types' field in package.json
- 77ff6a66: Generate Flow types from TypeScript types
- ec8d4b7f: Fix miscellaneous TypeScript errors

@@ -122,3 +131,3 @@ ## 2.1.1

- 91cb727c: Remove file extensions from imports
- 91cb727c: Remove file extensions from imports

@@ -129,7 +138,7 @@ ## 2.1.0

- 029b4810: Adds `useInterval()` hook that mimics the behavior of `ActionScheduler`'s
`interval()` method.
- c57cd770: Rename `useInterval` and `useTimeout` to `useScheduledInterval`
and `useScheduledTimeout` respectively.
- 29766c8e: Add `useInterval` and `useTimeout` hooks to provide an API for
using intervals and timeouts.
- 029b4810: Adds `useInterval()` hook that mimics the behavior of `ActionScheduler`'s
`interval()` method.
- c57cd770: Rename `useInterval` and `useTimeout` to `useScheduledInterval`
and `useScheduledTimeout` respectively.
- 29766c8e: Add `useInterval` and `useTimeout` hooks to provide an API for
using intervals and timeouts.

@@ -22,5 +22,5 @@ import * as React from 'react';

constructor(action, timeoutMs, schedulePolicy = SchedulePolicy.Immediately) {
this._timeoutId = void 0;
this._action = void 0;
this._timeoutMs = void 0;
this._timeoutId = undefined;
this._action = undefined;
this._timeoutMs = undefined;
if (typeof action !== "function") {

@@ -62,5 +62,5 @@ throw new Error("Action must be a function");

constructor(action, intervalMs, schedulePolicy = SchedulePolicy.Immediately) {
this._intervalId = void 0;
this._action = void 0;
this._intervalMs = void 0;
this._intervalId = undefined;
this._action = undefined;
this._intervalMs = undefined;
if (typeof action !== "function") {

@@ -102,4 +102,4 @@ throw new Error("Action must be a function");

constructor(action, schedulePolicy = SchedulePolicy.Immediately) {
this._animationFrameId = void 0;
this._action = void 0;
this._animationFrameId = undefined;
this._action = undefined;
if (typeof action !== "function") {

@@ -144,4 +144,4 @@ throw new Error("Action must be a function");

}
const timeout = new Timeout(action, period, options == null ? void 0 : options.schedulePolicy);
this._registeredActions.push(() => timeout.clear(options == null ? void 0 : options.clearPolicy));
const timeout = new Timeout(action, period, options == null ? undefined : options.schedulePolicy);
this._registeredActions.push(() => timeout.clear(options == null ? undefined : options.clearPolicy));
return timeout;

@@ -153,4 +153,4 @@ }

}
const interval = new Interval(action, period, options == null ? void 0 : options.schedulePolicy);
this._registeredActions.push(() => interval.clear(options == null ? void 0 : options.clearPolicy));
const interval = new Interval(action, period, options == null ? undefined : options.schedulePolicy);
this._registeredActions.push(() => interval.clear(options == null ? undefined : options.clearPolicy));
return interval;

@@ -162,4 +162,4 @@ }

}
const animationFrame = new AnimationFrame(action, options == null ? void 0 : options.schedulePolicy);
this._registeredActions.push(() => animationFrame.clear(options == null ? void 0 : options.clearPolicy));
const animationFrame = new AnimationFrame(action, options == null ? undefined : options.schedulePolicy);
this._registeredActions.push(() => animationFrame.clear(options == null ? undefined : options.clearPolicy));
return animationFrame;

@@ -202,14 +202,9 @@ }

function _extends() {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
return _extends = Object.assign ? Object.assign.bind() : function (n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
}
return target;
};
return _extends.apply(this, arguments);
return n;
}, _extends.apply(null, arguments);
}

@@ -241,3 +236,3 @@

var _intervalRef$current;
(_intervalRef$current = intervalRef.current) == null ? void 0 : _intervalRef$current.set();
(_intervalRef$current = intervalRef.current) == null || _intervalRef$current.set();
}

@@ -247,7 +242,7 @@ }

intervalRef.current = new Interval(() => {
actionProxyRef.current == null ? void 0 : actionProxyRef.current();
actionProxyRef.current == null || actionProxyRef.current();
}, intervalMs, schedulePolicy);
return () => {
var _intervalRef$current2;
(_intervalRef$current2 = intervalRef.current) == null ? void 0 : _intervalRef$current2.clear(clearPolicy);
(_intervalRef$current2 = intervalRef.current) == null || _intervalRef$current2.clear(clearPolicy);
intervalRef.current = null;

@@ -259,11 +254,11 @@ };

var _intervalRef$current3;
(_intervalRef$current3 = intervalRef.current) == null ? void 0 : _intervalRef$current3.set();
(_intervalRef$current3 = intervalRef.current) == null || _intervalRef$current3.set();
},
clear: policy => {
var _intervalRef$current4;
(_intervalRef$current4 = intervalRef.current) == null ? void 0 : _intervalRef$current4.clear(policy);
(_intervalRef$current4 = intervalRef.current) == null || _intervalRef$current4.clear(policy);
},
get isSet() {
var _intervalRef$current$, _intervalRef$current5;
return (_intervalRef$current$ = (_intervalRef$current5 = intervalRef.current) == null ? void 0 : _intervalRef$current5.isSet) != null ? _intervalRef$current$ : false;
return (_intervalRef$current$ = (_intervalRef$current5 = intervalRef.current) == null ? undefined : _intervalRef$current5.isSet) != null ? _intervalRef$current$ : false;
}

@@ -289,3 +284,3 @@ }), []);

var _timeoutRef$current;
(_timeoutRef$current = timeoutRef.current) == null ? void 0 : _timeoutRef$current.set();
(_timeoutRef$current = timeoutRef.current) == null || _timeoutRef$current.set();
}

@@ -295,7 +290,7 @@ }

timeoutRef.current = new Timeout(() => {
actionProxyRef.current == null ? void 0 : actionProxyRef.current();
actionProxyRef.current == null || actionProxyRef.current();
}, timeoutMs, schedulePolicy);
return () => {
var _timeoutRef$current2;
(_timeoutRef$current2 = timeoutRef.current) == null ? void 0 : _timeoutRef$current2.clear(clearPolicy);
(_timeoutRef$current2 = timeoutRef.current) == null || _timeoutRef$current2.clear(clearPolicy);
timeoutRef.current = null;

@@ -307,11 +302,11 @@ };

var _timeoutRef$current3;
(_timeoutRef$current3 = timeoutRef.current) == null ? void 0 : _timeoutRef$current3.set();
(_timeoutRef$current3 = timeoutRef.current) == null || _timeoutRef$current3.set();
},
clear: policy => {
var _timeoutRef$current4;
(_timeoutRef$current4 = timeoutRef.current) == null ? void 0 : _timeoutRef$current4.clear(policy);
(_timeoutRef$current4 = timeoutRef.current) == null || _timeoutRef$current4.clear(policy);
},
get isSet() {
var _timeoutRef$current$i, _timeoutRef$current5;
return (_timeoutRef$current$i = (_timeoutRef$current5 = timeoutRef.current) == null ? void 0 : _timeoutRef$current5.isSet) != null ? _timeoutRef$current$i : false;
return (_timeoutRef$current$i = (_timeoutRef$current5 = timeoutRef.current) == null ? undefined : _timeoutRef$current5.isSet) != null ? _timeoutRef$current$i : false;
}

@@ -318,0 +313,0 @@ }), []);

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var React = require('react');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
function _interopNamespaceDefault(e) {
var n = Object.create(null);

@@ -21,7 +18,7 @@ if (e) {

}
n["default"] = e;
n.default = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/_interopNamespace(React);
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);

@@ -46,5 +43,5 @@ let SchedulePolicy = function (SchedulePolicy) {

constructor(action, timeoutMs, schedulePolicy = SchedulePolicy.Immediately) {
this._timeoutId = void 0;
this._action = void 0;
this._timeoutMs = void 0;
this._timeoutId = undefined;
this._action = undefined;
this._timeoutMs = undefined;
if (typeof action !== "function") {

@@ -86,5 +83,5 @@ throw new Error("Action must be a function");

constructor(action, intervalMs, schedulePolicy = SchedulePolicy.Immediately) {
this._intervalId = void 0;
this._action = void 0;
this._intervalMs = void 0;
this._intervalId = undefined;
this._action = undefined;
this._intervalMs = undefined;
if (typeof action !== "function") {

@@ -126,4 +123,4 @@ throw new Error("Action must be a function");

constructor(action, schedulePolicy = SchedulePolicy.Immediately) {
this._animationFrameId = void 0;
this._action = void 0;
this._animationFrameId = undefined;
this._action = undefined;
if (typeof action !== "function") {

@@ -168,4 +165,4 @@ throw new Error("Action must be a function");

}
const timeout = new Timeout(action, period, options == null ? void 0 : options.schedulePolicy);
this._registeredActions.push(() => timeout.clear(options == null ? void 0 : options.clearPolicy));
const timeout = new Timeout(action, period, options == null ? undefined : options.schedulePolicy);
this._registeredActions.push(() => timeout.clear(options == null ? undefined : options.clearPolicy));
return timeout;

@@ -177,4 +174,4 @@ }

}
const interval = new Interval(action, period, options == null ? void 0 : options.schedulePolicy);
this._registeredActions.push(() => interval.clear(options == null ? void 0 : options.clearPolicy));
const interval = new Interval(action, period, options == null ? undefined : options.schedulePolicy);
this._registeredActions.push(() => interval.clear(options == null ? undefined : options.clearPolicy));
return interval;

@@ -186,4 +183,4 @@ }

}
const animationFrame = new AnimationFrame(action, options == null ? void 0 : options.schedulePolicy);
this._registeredActions.push(() => animationFrame.clear(options == null ? void 0 : options.clearPolicy));
const animationFrame = new AnimationFrame(action, options == null ? undefined : options.schedulePolicy);
this._registeredActions.push(() => animationFrame.clear(options == null ? undefined : options.clearPolicy));
return animationFrame;

@@ -226,14 +223,9 @@ }

function _extends() {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
return _extends = Object.assign ? Object.assign.bind() : function (n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
}
return target;
};
return _extends.apply(this, arguments);
return n;
}, _extends.apply(null, arguments);
}

@@ -265,3 +257,3 @@

var _intervalRef$current;
(_intervalRef$current = intervalRef.current) == null ? void 0 : _intervalRef$current.set();
(_intervalRef$current = intervalRef.current) == null || _intervalRef$current.set();
}

@@ -271,7 +263,7 @@ }

intervalRef.current = new Interval(() => {
actionProxyRef.current == null ? void 0 : actionProxyRef.current();
actionProxyRef.current == null || actionProxyRef.current();
}, intervalMs, schedulePolicy);
return () => {
var _intervalRef$current2;
(_intervalRef$current2 = intervalRef.current) == null ? void 0 : _intervalRef$current2.clear(clearPolicy);
(_intervalRef$current2 = intervalRef.current) == null || _intervalRef$current2.clear(clearPolicy);
intervalRef.current = null;

@@ -283,11 +275,11 @@ };

var _intervalRef$current3;
(_intervalRef$current3 = intervalRef.current) == null ? void 0 : _intervalRef$current3.set();
(_intervalRef$current3 = intervalRef.current) == null || _intervalRef$current3.set();
},
clear: policy => {
var _intervalRef$current4;
(_intervalRef$current4 = intervalRef.current) == null ? void 0 : _intervalRef$current4.clear(policy);
(_intervalRef$current4 = intervalRef.current) == null || _intervalRef$current4.clear(policy);
},
get isSet() {
var _intervalRef$current$, _intervalRef$current5;
return (_intervalRef$current$ = (_intervalRef$current5 = intervalRef.current) == null ? void 0 : _intervalRef$current5.isSet) != null ? _intervalRef$current$ : false;
return (_intervalRef$current$ = (_intervalRef$current5 = intervalRef.current) == null ? undefined : _intervalRef$current5.isSet) != null ? _intervalRef$current$ : false;
}

@@ -313,3 +305,3 @@ }), []);

var _timeoutRef$current;
(_timeoutRef$current = timeoutRef.current) == null ? void 0 : _timeoutRef$current.set();
(_timeoutRef$current = timeoutRef.current) == null || _timeoutRef$current.set();
}

@@ -319,7 +311,7 @@ }

timeoutRef.current = new Timeout(() => {
actionProxyRef.current == null ? void 0 : actionProxyRef.current();
actionProxyRef.current == null || actionProxyRef.current();
}, timeoutMs, schedulePolicy);
return () => {
var _timeoutRef$current2;
(_timeoutRef$current2 = timeoutRef.current) == null ? void 0 : _timeoutRef$current2.clear(clearPolicy);
(_timeoutRef$current2 = timeoutRef.current) == null || _timeoutRef$current2.clear(clearPolicy);
timeoutRef.current = null;

@@ -331,11 +323,11 @@ };

var _timeoutRef$current3;
(_timeoutRef$current3 = timeoutRef.current) == null ? void 0 : _timeoutRef$current3.set();
(_timeoutRef$current3 = timeoutRef.current) == null || _timeoutRef$current3.set();
},
clear: policy => {
var _timeoutRef$current4;
(_timeoutRef$current4 = timeoutRef.current) == null ? void 0 : _timeoutRef$current4.clear(policy);
(_timeoutRef$current4 = timeoutRef.current) == null || _timeoutRef$current4.clear(policy);
},
get isSet() {
var _timeoutRef$current$i, _timeoutRef$current5;
return (_timeoutRef$current$i = (_timeoutRef$current5 = timeoutRef.current) == null ? void 0 : _timeoutRef$current5.isSet) != null ? _timeoutRef$current$i : false;
return (_timeoutRef$current$i = (_timeoutRef$current5 = timeoutRef.current) == null ? undefined : _timeoutRef$current5.isSet) != null ? _timeoutRef$current$i : false;
}

@@ -342,0 +334,0 @@ }), []);

{
"name": "@khanacademy/wonder-blocks-timing",
"private": false,
"version": "0.0.0-PR2414-20241220221259",
"version": "0.0.0-PR2453-20250204180605",
"design": "v1",

@@ -13,6 +13,2 @@ "publishConfig": {

"types": "dist/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prepublishOnly": "../../utils/publish/package-pre-publish-check.sh"
},
"peerDependencies": {

@@ -22,7 +18,10 @@ "react": "18.2.0"

"devDependencies": {
"@khanacademy/wb-dev-build-settings": "^2.0.0",
"@khanacademy/wonder-blocks-testing-core": "0.0.0-PR2414-20241220221259"
"@khanacademy/wonder-blocks-testing-core": "0.0.0-PR2453-20250204180605",
"@khanacademy/wb-dev-build-settings": "0.0.0-PR2453-20250204180605"
},
"author": "",
"license": "MIT"
"license": "MIT",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
}
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