Skip to content

Locking memoryless Callbacks aborts current execution #1990

@gibson042

Description

@gibson042

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 );

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions