@umijs/use-request
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -6,3 +6,3 @@ import { DependencyList, RefObject } from 'react'; | ||
export declare type Subscribe<R, P extends any[]> = (data: FetchResult<R, P>) => void; | ||
export declare type Mutate<R> = (x: (R | ((data: R) => R))) => void; | ||
export declare type Mutate<R> = (x: (R | undefined | ((data: R) => R))) => void; | ||
export declare type RequestService = string | { | ||
@@ -9,0 +9,0 @@ [key: string]: any; |
@@ -6,3 +6,3 @@ import { DependencyList, RefObject } from 'react'; | ||
export declare type Subscribe<R, P extends any[]> = (data: FetchResult<R, P>) => void; | ||
export declare type Mutate<R> = (x: (R | ((data: R) => R))) => void; | ||
export declare type Mutate<R> = (x: (R | undefined | ((data: R) => R))) => void; | ||
export declare type RequestService = string | { | ||
@@ -9,0 +9,0 @@ [key: string]: any; |
@@ -41,5 +41,3 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
var Fetch = | ||
/*#__PURE__*/ | ||
function () { | ||
var Fetch = /*#__PURE__*/function () { | ||
// 请求时序 | ||
@@ -46,0 +44,0 @@ // 是否卸载 |
@@ -25,3 +25,3 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
import { useCallback, useMemo, useRef, useEffect } from 'react'; | ||
import { useCallback, useEffect, useMemo, useRef } from 'react'; | ||
import useAsync from './useAsync'; | ||
@@ -28,0 +28,0 @@ import useUpdateEffect from './utils/useUpdateEffect'; |
@@ -8,5 +8,5 @@ export default function limit(fn, timespan) { | ||
setTimeout(function () { | ||
return pending = false; | ||
pending = false; | ||
}, timespan); | ||
}; | ||
} |
@@ -9,3 +9,3 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
import { useCallback, useRef, useEffect } from "react"; | ||
import { useCallback, useRef, useEffect } from 'react'; | ||
@@ -21,6 +21,6 @@ function usePersistFn(fn) { | ||
var persist = useCallback(function () { | ||
var fn = ref.current; | ||
var refFn = ref.current; | ||
if (fn) { | ||
return fn.apply(void 0, arguments); | ||
if (refFn) { | ||
return refFn.apply(void 0, arguments); | ||
} | ||
@@ -31,7 +31,7 @@ }, [ref]); | ||
return persist; | ||
} else { | ||
return undefined; | ||
} | ||
return undefined; | ||
} | ||
export default usePersistFn; |
@@ -6,3 +6,3 @@ import { DependencyList, RefObject } from 'react'; | ||
export declare type Subscribe<R, P extends any[]> = (data: FetchResult<R, P>) => void; | ||
export declare type Mutate<R> = (x: (R | ((data: R) => R))) => void; | ||
export declare type Mutate<R> = (x: (R | undefined | ((data: R) => R))) => void; | ||
export declare type RequestService = string | { | ||
@@ -9,0 +9,0 @@ [key: string]: any; |
@@ -60,5 +60,3 @@ "use strict"; | ||
var Fetch = | ||
/*#__PURE__*/ | ||
function () { | ||
var Fetch = /*#__PURE__*/function () { | ||
// 请求时序 | ||
@@ -65,0 +63,0 @@ // 是否卸载 |
@@ -15,5 +15,5 @@ "use strict"; | ||
setTimeout(function () { | ||
return pending = false; | ||
pending = false; | ||
}, timespan); | ||
}; | ||
} |
@@ -27,6 +27,6 @@ "use strict"; | ||
var persist = (0, _react.useCallback)(function () { | ||
var fn = ref.current; | ||
var refFn = ref.current; | ||
if (fn) { | ||
return fn.apply(void 0, arguments); | ||
if (refFn) { | ||
return refFn.apply(void 0, arguments); | ||
} | ||
@@ -37,5 +37,5 @@ }, [ref]); | ||
return persist; | ||
} else { | ||
return undefined; | ||
} | ||
return undefined; | ||
} | ||
@@ -42,0 +42,0 @@ |
{ | ||
"name": "@umijs/use-request", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "React Hooks for fetching, caching and updating asynchronous data", | ||
@@ -38,6 +38,6 @@ "main": "./lib/index.js", | ||
"devDependencies": { | ||
"@umijs/hooks": "^1.6.2", | ||
"@umijs/hooks": "^1.7.0", | ||
"axios": "^0.19.2" | ||
}, | ||
"gitHead": "c09e1d37b0ae60f10776ff5ef25447f196c0fd1c" | ||
"gitHead": "4ea8f5c04c06eff2a33b2be473a8f7460909bebb" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123692
78
2599