#73 : Add resize observer
This commit is contained in:
@@ -105,21 +105,6 @@ export function applyClones({
|
||||
}
|
||||
}
|
||||
|
||||
export function getPageSizes({
|
||||
pageWindowElement,
|
||||
pagesContainerChildren,
|
||||
}) {
|
||||
const pagesWindowWidth = pageWindowElement.clientWidth
|
||||
const pageWidth = pagesWindowWidth
|
||||
const pagesCount = pagesContainerChildren.length
|
||||
|
||||
return {
|
||||
pagesWindowWidth,
|
||||
pageWidth,
|
||||
pagesCount,
|
||||
}
|
||||
}
|
||||
|
||||
export function applyPageSizes({
|
||||
pagesContainerChildren,
|
||||
pageWidth,
|
||||
@@ -157,3 +142,11 @@ export function getOneSideClonesCount({
|
||||
}) {
|
||||
return infinite ? 1 : 0
|
||||
}
|
||||
|
||||
export function createResizeObserver(onResize) {
|
||||
return new ResizeObserver(entries => {
|
||||
onResize({
|
||||
width: entries[0].contentRect.width,
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user