Skip to content

Can just-debounce-it run the first and last call? #573

@thebjorn

Description

@thebjorn

If I call debounce like this:

let i = 1;
const logValue = debounce(() => console.log(i++), 500, true);
logValue();
logValue();
logValue();

it prints 1 and 2. Is there any way to make it print 1 and 3?

I'd like to use it for auto-saving editor updates, so the last call is important.

I couldn't see a way of accomplishing it from the docs. If it's not currently possible, is it something you would consider implementing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions