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

react-waitables

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-waitables - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

lib/internal-utils/make-value-with-args-then-do.d.ts

4

lib/specialized-waitables/use-derived-waitable/types/transformers.d.ts

@@ -5,5 +5,5 @@ import type { TypeOrPromisedType } from '../../../resolveable/types';

/** A transformer that requires all waitable values to be loaded. */
export declare type UseDerivedWaitableRequiredValuesTransformer<SuccessT, FailureT, DependenciesT extends WaitableDependencies = Record<string, never>> = (dependencyValues: InferRequiredWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT, setFailure: (failure: FailureT) => void) => TypeOrPromisedType<SuccessT | undefined>;
export declare type UseDerivedWaitableRequiredValuesTransformer<SuccessT, FailureT, DependenciesT extends WaitableDependencies = Record<string, never>> = (dependencyValues: InferRequiredWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT, setFailure: (failure: FailureT) => void, wasReset: () => boolean) => TypeOrPromisedType<SuccessT | undefined>;
/** A transformer that doesn't require all waitable values to be loaded. */
export declare type UseDerivedWaitableOptionalValuesTransformer<SuccessT, FailureT, DependenciesT extends WaitableDependencies = Record<string, never>> = (dependencyValues: InferOptionalWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT, setFailure: (failure: FailureT) => void) => TypeOrPromisedType<SuccessT | undefined>;
export declare type UseDerivedWaitableOptionalValuesTransformer<SuccessT, FailureT, DependenciesT extends WaitableDependencies = Record<string, never>> = (dependencyValues: InferOptionalWaitableAndBindingValueTypes<DependenciesT>, dependencies: DependenciesT, setFailure: (failure: FailureT) => void, wasReset: () => boolean) => TypeOrPromisedType<SuccessT | undefined>;
/**

@@ -10,0 +10,0 @@ * Transformers that are used depending on the state of the waitables.

@@ -126,3 +126,3 @@ "use strict";

*/
const evaluate = (0, use_callback_ref_1.useCallbackRef)(({ setSuccess, setFailure }) => {
const evaluate = (0, use_callback_ref_1.useCallbackRef)(({ setSuccess, setFailure, wasReset }) => {
const { allWaitablesAreLoaded, anyWaitablesHadErrors, lastError, values } = (0, extract_waitable_dependency_values_1.extractOptionalWaitableDependencyValues)({

@@ -136,3 +136,3 @@ dependencies,

var _a;
return (_a = getLoadedTransformer()) === null || _a === void 0 ? void 0 : _a(values, dependencies !== null && dependencies !== void 0 ? dependencies : emptyDependencies, setFailure);
return (_a = getLoadedTransformer()) === null || _a === void 0 ? void 0 : _a(values, dependencies !== null && dependencies !== void 0 ? dependencies : emptyDependencies, setFailure, wasReset);
}, setSuccess);

@@ -144,3 +144,3 @@ }

var _a;
return (_a = getErrorTransformer()) === null || _a === void 0 ? void 0 : _a(values, dependencies !== null && dependencies !== void 0 ? dependencies : emptyDependencies, setFailure);
return (_a = getErrorTransformer()) === null || _a === void 0 ? void 0 : _a(values, dependencies !== null && dependencies !== void 0 ? dependencies : emptyDependencies, setFailure, wasReset);
}, (value) => {

@@ -159,3 +159,3 @@ if (value !== undefined) {

var _a;
return (_a = getLoadingTransformer()) === null || _a === void 0 ? void 0 : _a(values, dependencies !== null && dependencies !== void 0 ? dependencies : emptyDependencies, setFailure);
return (_a = getLoadingTransformer()) === null || _a === void 0 ? void 0 : _a(values, dependencies !== null && dependencies !== void 0 ? dependencies : emptyDependencies, setFailure, wasReset);
}, setSuccess);

@@ -162,0 +162,0 @@ }

@@ -13,3 +13,5 @@ import type { EmptyObject } from 'react-bindings';

*/
export declare const useWaitableFunction: <SuccessT, FailureT = any, ExtraFieldsT = EmptyObject>(primaryFunc: () => TypeOrPromisedType<WrappedResult<SuccessT, FailureT>>, options: UseWaitableArgs<SuccessT, FailureT, ExtraFieldsT>) => import("..").Waitable<SuccessT, FailureT> & ExtraFieldsT;
export declare const useWaitableFunction: <SuccessT, FailureT = any, ExtraFieldsT = EmptyObject>(primaryFunc: (args: {
wasReset: () => boolean;
}) => TypeOrPromisedType<WrappedResult<SuccessT, FailureT>>, options: UseWaitableArgs<SuccessT, FailureT, ExtraFieldsT>) => import("..").Waitable<SuccessT, FailureT> & ExtraFieldsT;
//# sourceMappingURL=use-waitable-function.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useWaitableFunction = void 0;
const make_value_then_do_1 = require("../internal-utils/make-value-then-do");
const make_value_with_args_then_do_1 = require("../internal-utils/make-value-with-args-then-do");
const use_waitable_1 = require("../use-waitable/use-waitable");

@@ -14,3 +14,3 @@ /**

*/
const useWaitableFunction = (primaryFunc, options) => (0, use_waitable_1.useWaitable)(({ setSuccess, setFailure }) => (0, make_value_then_do_1.makeValueThenDo)(primaryFunc, (result) => {
const useWaitableFunction = (primaryFunc, options) => (0, use_waitable_1.useWaitable)(({ setSuccess, setFailure, wasReset }) => (0, make_value_with_args_then_do_1.makeValueWithArgsThenDo)(primaryFunc, [{ wasReset }], (result) => {
if (result === undefined) {

@@ -17,0 +17,0 @@ return;

{
"name": "react-waitables",
"version": "1.1.1",
"version": "1.2.0",
"description": "Async data bindings for React",

@@ -39,6 +39,6 @@ "keywords": [

"is-promise": "^4.0.0",
"react-bindings": "^1.3.3"
"react-bindings": "^1.3.4"
},
"devDependencies": {
"@testing-library/react" : "^13.3.0",
"@testing-library/react": "^13.3.0",
"@types/jest": "^28.1.1",

@@ -45,0 +45,0 @@ "@types/react": "18.0.14",

Sorry, the diff of this file is not supported yet

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