File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
packages/hooks/src/useAsyncEffect Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,16 @@ import type { DependencyList } from 'react';
2
2
import { useEffect } from 'react' ;
3
3
import { isFunction } from '../utils' ;
4
4
5
+ function isAsyncGenerator (
6
+ val : AsyncGenerator < void , void , void > | Promise < void > ,
7
+ ) : val is AsyncGenerator < void , void , void > {
8
+ return isFunction ( val [ Symbol . asyncIterator ] ) ;
9
+ }
10
+
5
11
function useAsyncEffect (
6
12
effect : ( ) => AsyncGenerator < void , void , void > | Promise < void > ,
7
13
deps ?: DependencyList ,
8
14
) {
9
- function isAsyncGenerator (
10
- val : AsyncGenerator < void , void , void > | Promise < void > ,
11
- ) : val is AsyncGenerator < void , void , void > {
12
- return isFunction ( val [ Symbol . asyncIterator ] ) ;
13
- }
14
15
useEffect ( ( ) => {
15
16
const e = effect ( ) ;
16
17
let cancelled = false ;
You can’t perform that action at this time.
0 commit comments