File tree Expand file tree Collapse file tree 3 files changed +9
-11
lines changed Expand file tree Collapse file tree 3 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,7 @@ const useMutationObserver = (
19
19
const observer = new MutationObserver ( callbackRef . current ) ;
20
20
observer . observe ( element , options ) ;
21
21
return ( ) => {
22
- if ( observer ) {
23
- observer . disconnect ( ) ;
24
- }
22
+ observer ?. disconnect ( ) ;
25
23
} ;
26
24
} ,
27
25
[ options ] ,
Original file line number Diff line number Diff line change @@ -29,10 +29,10 @@ const position = useScroll(target, shouldUpdate);
29
29
30
30
### Params
31
31
32
- | Property | Description | Type | Default |
33
- | ------------ | ------------------------- | --------------------------------------------------------------------------- | ---------- |
34
- | target | DOM element or ref object | ` Element ` \| ` Document ` \| ` (() => Element) ` \| ` MutableRefObject<Element> ` | ` document ` |
35
- | shouldUpdate | Whether update position | ` ({ top: number, left: number }) => boolean ` | ` - ` |
32
+ | Property | Description | Type | Default |
33
+ | ------------ | ------------------------- | --------------------------------------------------------------------------- | ------------ |
34
+ | target | DOM element or ref object | ` Element ` \| ` Document ` \| ` (() => Element) ` \| ` MutableRefObject<Element> ` | ` document ` |
35
+ | shouldUpdate | Whether update position | ` ({ top: number, left: number }) => boolean ` | ` () => true ` |
36
36
37
37
### Result
38
38
Original file line number Diff line number Diff line change @@ -29,10 +29,10 @@ const position = useScroll(target, shouldUpdate);
29
29
30
30
### Params
31
31
32
- | 参数 | 说明 | 类型 | 默认值 |
33
- | ------------ | -------------------- | --------------------------------------------------------------------------- | ---------- |
34
- | target | DOM 节点或者 ref | ` Element ` \| ` Document ` \| ` (() => Element) ` \| ` MutableRefObject<Element> ` | ` document ` |
35
- | shouldUpdate | 控制是否更新滚动信息 | ` ({ top: number, left: number }) => boolean ` | - |
32
+ | 参数 | 说明 | 类型 | 默认值 |
33
+ | ------------ | -------------------- | --------------------------------------------------------------------------- | ------------ |
34
+ | target | DOM 节点或者 ref | ` Element ` \| ` Document ` \| ` (() => Element) ` \| ` MutableRefObject<Element> ` | ` document ` |
35
+ | shouldUpdate | 控制是否更新滚动信息 | ` ({ top: number, left: number }) => boolean ` | ` () => true ` |
36
36
37
37
### Result
38
38
You can’t perform that action at this time.
0 commit comments