FIND YOUR NEXT FEW LINES

The snippet library.

Small, practical examples. Search by task or narrow things down below.

10 snippets foundClear filters
jQueryDeferred work & queues

Expose observation without exposing resolution

jQuery: promise returns an interface without resolve or reject methods.

jQuery✓ Tested
jQueryDeferred work & queues

Inspect a deferred’s lifecycle state

jQuery: state reports pending, resolved, or rejected.

jQuery✓ Tested
jQueryDeferred work & queues

Observe completion of queued work

jQuery: The queue promise resolves when the selected elements’ queue is empty.

jQuery✓ Tested
jQueryDeferred work & queues

Reject a deferred result

jQuery: fail receives the reason supplied to reject.

jQuery✓ Tested
jQueryDeferred work & queues

Report progress before completion

jQuery: notify calls registered progress handlers while the deferred is pending.

jQuery✓ Tested
jQueryDeferred work & queues

Resolve a deferred result

jQuery: done receives the value supplied to resolve.

jQuery✓ Tested
jQueryDeferred work & queues

Sequence work on an element’s queue

jQuery: A queue callback calls next to allow the following callback to run.

jQuery✓ Tested
jQueryDeferred work & queues

Start a named queue explicitly

jQuery: Named queues wait until dequeue starts them.

jQuery✓ Tested
jQueryDeferred work & queues

Transform a deferred value with then

jQuery: then returns a new promise with the callback’s result.

jQuery✓ Tested
jQueryDeferred work & queues

Wait for several deferred values

jQuery: when resolves only after every supplied deferred has resolved.

jQuery✓ Tested