Refactored code annotations

This commit is contained in:
squidfunk
2021-11-28 13:01:27 +01:00
parent f6503920b1
commit abe475e151
28 changed files with 639 additions and 373 deletions

View File

@@ -53,7 +53,9 @@ export interface ElementOffset {
*
* @returns Element offset
*/
export function getElementOffset(el: HTMLElement): ElementOffset {
export function getElementOffset(
el: HTMLElement
): ElementOffset {
return {
x: el.offsetLeft,
y: el.offsetTop

View File

@@ -43,7 +43,9 @@ import { ElementOffset } from "../_"
*
* @returns Element content offset
*/
export function getElementContentOffset(el: HTMLElement): ElementOffset {
export function getElementContentOffset(
el: HTMLElement
): ElementOffset {
return {
x: el.scrollLeft,
y: el.scrollTop

View File

@@ -28,6 +28,7 @@ import {
filter,
finalize,
map,
merge,
of,
shareReplay,
startWith,
@@ -73,7 +74,7 @@ const observer$ = defer(() => of(
})
))
.pipe(
switchMap(observer => NEVER.pipe(startWith(observer))
switchMap(observer => merge(NEVER, of(observer))
.pipe(
finalize(() => observer.disconnect())
)
@@ -92,7 +93,9 @@ const observer$ = defer(() => of(
*
* @returns Element size
*/
export function getElementSize(el: HTMLElement): ElementSize {
export function getElementSize(
el: HTMLElement
): ElementSize {
return {
width: el.offsetWidth,
height: el.offsetHeight

View File

@@ -33,7 +33,9 @@ import { ElementSize } from "../_"
*
* @returns Element content size
*/
export function getElementContentSize(el: HTMLElement): ElementSize {
export function getElementContentSize(
el: HTMLElement
): ElementSize {
return {
width: el.scrollWidth,
height: el.scrollHeight

View File

@@ -29,6 +29,7 @@ import {
filter,
finalize,
map,
merge,
of,
shareReplay,
startWith,
@@ -68,7 +69,7 @@ const observer$ = defer(() => of(
})
))
.pipe(
switchMap(observer => NEVER.pipe(startWith(observer))
switchMap(observer => merge(NEVER, of(observer))
.pipe(
finalize(() => observer.disconnect())
)