Skip to content

Offering throttled- and debounced variants #53

Closed
@ZeeCoder

Description

Instead of having them as options, I think it would be better to ship composing hooks, basically as they are outlined in the readme already:

This would allow me to keep the base interface minimalistic, while at the same time offer solutions to a seemingly frequent use case.

This is how it would look I think:

import useResizeObserver from 'use-resize-observer/throttled';
import useResizeObserver from 'use-resize-observer/debounced';

// Where the API / options are the exact same.

The only downside that I would probably have to provide polyfilled builds as well, so maybe:

import useResizeObserver from 'use-resize-observer/throttled/polyfilled';
import useResizeObserver from 'use-resize-observer/debounced/polyfilled';

And of course I would have to run the whole test suite and more on these builds.

I'll just leave this issue here to assess demand.

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions