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

[Feature Request] useSize() options support #2227

Open
kkimdev opened this issue Jun 21, 2023 · 6 comments
Open

[Feature Request] useSize() options support #2227

kkimdev opened this issue Jun 21, 2023 · 6 comments
Assignees
Labels
feature New feature or request

Comments

@kkimdev
Copy link

kkimdev commented Jun 21, 2023

ResizeObserver.observe() has options https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/observe , but that's not configurable from useSize() currently.

My usecase is using border-box option.

@liuyib liuyib self-assigned this Jun 21, 2023
@liuyib
Copy link
Collaborator

liuyib commented Jun 21, 2023

It's a great suggestion, we'll add it in the future version.

@askwuxue
Copy link
Contributor

It's a great suggestion, we'll add it in the future version.

ahooks relies on the resize-observer-polyfill package, but the author of resize-observer-polyfill hasn't maintained it for a long time, so it doesn't support the options parameter for observe(). I'm wondering if there's an alternative solution, such as using @juggle/resize-observer.

@askwuxue
Copy link
Contributor

It's a great suggestion, we'll add it in the future version.

ahooks relies(依赖) on the resize-observer-polyfill package, but the author of resize-observer-polyfill hasn't maintained(保持) it for a long time, so it doesn't support the options parameter for observe(). I'm wondering if there's an alternative(替代品) solution, such as using @juggle/resize-observer.

但这是一个Break change。原因是resize-observer-polyfill这个库在计算时,是 content width + padding。

@liuyib
Copy link
Collaborator

liuyib commented Jun 26, 2023

但这是一个Break change。原因是resize-observer-polyfill这个库在计算时,是 content width + padding。

这俩个库哪个是按照规范来的呢?


我看到 @juggle/resize-observer 是按照最新的规范来的,但是其 READMD 注明了最新的规范还没完成:
image

@askwuxue
Copy link
Contributor

但这是一个Break change。原因是resize-observer-polyfill这个库在计算时,是 content width + padding。

这俩个库哪个是按照规范来的呢?

我看到 @juggle/resize-observer 是按照最新的规范来的,但是其 READMD 注明了最新的规范还没完成: image

如果按照MDN当前定义的规范的话,@juggle/resize-observer 是符合规范来的。至少是支持options选项的。

@liuyib
Copy link
Collaborator

liuyib commented Jun 27, 2023

如果按照MDN当前定义的规范的话,@juggle/resize-observer 是符合规范来的。至少是支持options选项的。

Get! 感谢你提供的参考建议~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants