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

Locking memoryless Callbacks aborts current execution #1990

Closed
gibson042 opened this Issue Jan 4, 2015 · 0 comments

Comments

Projects
None yet
2 participants
@gibson042
Member

gibson042 commented Jan 4, 2015

http://jsfiddle.net/2d9gwd2c/

Note how .lock() aborts active execution unless the "memory" flag is set. This is arguably by design, but it seems to me that the purpose of the method is preventing effects of future fire calls—execution interruption being more properly provided by the "stopOnFalse" flag.

This has probably gone unnoticed for lack of use (all of our internal callbacks have memory), but nonetheless would be a breaking fix and called for with a major version bump.

In code, this assertion fails:

var completed,
    list = jQuery.Callbacks();
list.add( list.lock );
list.add(function() { completed = true; });
list.fire();
equal( completed, true );

@gibson042 gibson042 added the Callbacks label Jan 4, 2015

@gibson042 gibson042 self-assigned this Jan 4, 2015

@gibson042 gibson042 added this to the 3.0.0 milestone Jan 4, 2015

gibson042 added a commit that referenced this issue Jan 11, 2015

@gibson042 gibson042 closed this in 32bf917 Jan 11, 2015

@lock lock bot locked as resolved and limited conversation to collaborators Jun 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.