File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
< script >
2
2
window . deep = window . deep || { } ;
3
3
4
+ // TODO: JSDoc
4
5
ElementBehaviorImpl = {
5
6
properties : {
6
7
/* True if the element is visible to the user. False otherwise. */
7
- isVisible : {
8
+ isVisibleToUser : {
8
9
type : Boolean ,
9
10
value : false
10
11
} ,
11
12
/* Observer monitoring resize events */
12
13
__resizeObserver : Object
13
14
} ,
14
15
attached ( ) {
15
- this . __resizeObserver = new ResizeObserver ( this . __updateVisibility ) ;
16
+ this . __resizeObserver = new ResizeObserver ( this . __updateVisibility . bind ( this ) ) ;
16
17
this . __resizeObserver . observe ( this ) ;
17
18
} ,
18
19
detached ( ) {
19
-
20
+ this . __resizeObserver . disconnect ( ) ;
20
21
} ,
21
22
__updateVisibility ( resizeEntries ) {
22
23
if ( ! Array . isArray ( resizeEntries ) || ! resizeEntries . length ) return ;
23
24
const boundingRectangle = resizeEntries [ 0 ] . contentRect ;
24
25
const { height, width} = boundingRectangle ;
25
- this . set ( 'isVisible ' , Boolean ( height ) || Boolean ( width ) ) ;
26
+ this . set ( 'isVisibleToUser ' , Boolean ( height ) || Boolean ( width ) ) ;
26
27
}
27
28
} ;
28
29
deep . ElementBehavior = [ ElementBehaviorImpl ] ;
You can’t perform that action at this time.
0 commit comments