Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add useResizeObserver option #51

Merged
merged 12 commits into from
Sep 21, 2023

Conversation

anuu0916
Copy link
Collaborator

@anuu0916 anuu0916 commented Sep 18, 2023

Issue

#50

Details

@anuu0916 anuu0916 closed this Sep 18, 2023
@anuu0916 anuu0916 reopened this Sep 18, 2023
@anuu0916 anuu0916 closed this Sep 18, 2023
@anuu0916 anuu0916 changed the title Use resize observer#50 코드리뷰용 임시 PR feat: add useResizeObserver option Sep 18, 2023
@anuu0916 anuu0916 reopened this Sep 18, 2023
@@ -454,6 +456,16 @@ class Conveyer extends Component<ConveyerEvents> {
useNormalized: false,
}));
}
if (!IS_IE && options.useResizeObserver) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than comparing with IS_IE, compare with/without ResizeObserver.

@anuu0916 anuu0916 marked this pull request as draft September 18, 2023 08:07
@anuu0916 anuu0916 marked this pull request as ready for review September 18, 2023 08:12
@anuu0916 anuu0916 marked this pull request as draft September 19, 2023 07:02
@anuu0916 anuu0916 marked this pull request as ready for review September 19, 2023 07:16
@anuu0916 anuu0916 marked this pull request as draft September 19, 2023 07:39
@anuu0916 anuu0916 marked this pull request as ready for review September 20, 2023 09:39

entries.forEach((entry: ResizeObserverEntry) => {
if (entry.target !== this._scrollAreaElement) {
for (let i = 0; i < items.length; i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to make items.length a constant.

@@ -312,10 +316,22 @@ class Conveyer extends Component<ConveyerEvents> {
public updateItems() {
const scrollAreaElement = this._scrollAreaElement;
const itemSelector = this._options.itemSelector;
const childrenDiffer = this._childrenDiffer;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good to use children differ. Rather than using classes/instances. Use the function `import { diff } from "@egjs/children-differ".

@anuu0916 anuu0916 marked this pull request as draft September 21, 2023 02:44
@anuu0916 anuu0916 marked this pull request as ready for review September 21, 2023 02:46
this.setItems(itemElements.map((el) => this._getItem(el)));

if (resizeObserver){
const prevItemElements = this._itemElements;
Copy link
Member

@daybrush daybrush Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be no need to create _itemElements.

Use items.map(item => item.element).

@daybrush daybrush merged commit 57138e7 into naver:main Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants