Skip to content

Cancel should set timeoutId to null#3782

Merged
cschleiden merged 4 commits into
microsoft:masterfrom
abettadapur:debounceCancel
Jan 24, 2018
Merged

Cancel should set timeoutId to null#3782
cschleiden merged 4 commits into
microsoft:masterfrom
abettadapur:debounceCancel

Conversation

@abettadapur

@abettadapur abettadapur commented Jan 23, 2018

Copy link
Copy Markdown
Collaborator

Pull request checklist

Description of changes

  • Create a markExecuted function, which clears timeout and sets timeoutId to null
  • Cancel, flush, and invoke now call this markExecuted function

this.clearTimeout(timeoutId);
if (pending()) {
// Mark the debounced function as having executed
markExecuted(new Date().getTime());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If I cancel before it was ever executed should we still do that?

@cschleiden cschleiden merged commit c0d264e into microsoft:master Jan 24, 2018
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

async.debounce.cancel() results in further calls not being fired

2 participants