O'Reilly logo

Learning jQuery Third Edition by Karl Swedberg, Jonathan Chaffer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Deferred objects

Deferred objects and their promises allow us to react to the completion of long-running tasks with a convenient syntax. They are discussed in detail in Chapter 11.

Object creation

Function

Description

$.Deferred([setupFunction])

Returns a new deferred object

$.when(deferreds)

Returns a promise object to be resolved when the given deferred objects are resolved

Methods of deferred objects

Method

Description

.resolve([args])

Sets the state of the object to resolved

.resolveWith(context, [args])

Sets the state of the object to resolved, while making the keyword this refer to context within callbacks

.reject([args])

Sets the state of the object to resolved

.rejectWith(context, [args])

Sets the state ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required