The notifyWith() method sends progress updates like notify(), but lets you set this inside progress() callbacks and pass arguments as an array. This tutorial covers syntax, five examples, comparisons with notify() and resolveWith(), and when custom context matters.
01
Syntax
notifyWith(ctx, args)
02
context
Sets this
03
args
Array of values
04
progress()
Receives updates
05
vs notify
Context control
06
Since 1.7
With progress API
Fundamentals
Introduction
Progress handlers often need to update a specific UI widget or view model. Inside a plain progress() callback, this may not point where you expect — especially after setTimeout or nested functions. notifyWith(context, args) solves that by binding this to your chosen object for each progress notification.
It mirrors the With family: resolveWith() for success, rejectWith() for failure, and notifyWith() for interim progress — all with the same context-and-array pattern.
Concept
Understanding the notifyWith() Method
notifyWith() is part of jQuery’s Deferred Object API (since jQuery 1.7). Calling deferred.notifyWith(context, args) invokes every progress() handler with this set to context and parameters taken from the args array.
The Deferred stays pending — just like notify(). When work completes, call resolve(), resolveWith(), or the matching reject method to settle the final outcome.
💡
Beginner Tip
The original reference used deferred.notifyWith(this, [progress]) inside setTimeout, where this is usually the global object — not your task controller. Pass an explicit context object (e.g. uploadView) instead, and always finish with resolve() when progress reaches 100%.
Foundation
📝 Syntax
General form of deferred.notifyWith:
jQuery
deferred.notifyWith( context, args )
Parameters
context — object used as this when each progress() callback runs.
args — array or array-like object whose values are passed as separate arguments to progress handlers (e.g. [50] or [2, 5, "Saving"]).
Return value
Returns the same Deferred object for chaining further progress or settlement calls.
When handlers need object methods or properties, notifyWith(context, args) is clearer than fighting default this binding or wrapping every call in .call().
Example 4 — Multiple Values in the args Array
Pass step index, total, and label as separate parameters via the array.
Inside timers, never rely on bare this. Pass task as context, then call resolveWith(task, [...]) so success handlers can use the same object if needed.
Applications
🚀 Use Cases
File upload widgets — bind progress to an uploader instance that owns the progress bar element.
Multi-step wizards — pass step metadata with a wizard controller as this.
Background sync tasks — report percent complete from timers or workers without losing object context.
Form submission flows — update validation or save status on a form view model during server round-trips.
Consistent With-methods — use the same context for notifyWith(), resolveWith(), and rejectWith() in one workflow.
jQuery sets this = context and spreads args into each callback.
Bind
3
Repeat / settle
Call again while pending; finish with resolveWith() or resolve().
Complete
=
🔗
Context preserved
Progress and completion handlers can share the same controller object.
Important
📝 Notes
The args parameter must be array-like — use [value] even for a single argument.
notifyWith() does not run done() or fail() — only progress() handlers.
After resolve or reject, further notifyWith() calls are ignored.
Prefer explicit context objects over bare this inside async callbacks.
Consumers holding only a promise() cannot call notifyWith() — only the Deferred owner emits progress.
Compatibility
Browser Support
deferred.notifyWith() has been available since jQuery 1.7 alongside notify() and progress().
✓ jQuery 1.7+
jQuery Deferred.notifyWith()
Supported in jQuery 1.7+, 2.x, and 3.x wherever jQuery Deferred runs. Part of the jQuery-specific progress API — not in native Promises.
100%With jQuery loaded
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
deferred.notifyWith()Universal
Bottom line: Use when progress handlers need a stable this reference. For simple messages without context, notify() is enough.
Wrap Up
🎉 Conclusion
The deferred.notifyWith() method combines progress updates with explicit context binding. Pass your view or widget as the first argument, wrap callback parameters in an array, and settle with resolveWith() when the job finishes.
Next, explore pipe() to transform Deferred values through a chain, or review progress() for the listener side of progress reporting.
Reuse the same context for progress and final settlement
Register progress() before the first notify
❌ Don’t
Rely on this inside setTimeout without notifyWith
Pass a raw value instead of an array as the second argument
Skip final resolve after the last progress update
Call notifyWith after the Deferred settled
Use notifyWith when plain notify() and closure variables suffice
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about notifyWith()
Progress updates with controlled this binding.
5
Core concepts
📝01
Syntax
ctx + args[]
API
🔗02
this
= context
Binding
📦03
args
Array-like
Params
📈04
Pending
Not final
State
With05
Family
resolveWith too
Pattern
❓ Frequently Asked Questions
notifyWith(context, args) fires progress() handlers like notify(), but sets this inside each callback to context and passes arguments from the args array (or array-like object).
notify(value) uses the default this binding and passes arguments directly. notifyWith(ctx, [a, b]) lets you choose this and wrap multiple values in an array — the same pattern as resolveWith() and rejectWith().
args must be an array or array-like object (e.g. [percent] or [step, total, label]). jQuery spreads those values as separate parameters to your progress callback.
Use it when progress handlers are methods on a UI widget, view model, or service object and you want this to refer to that object — especially inside setTimeout or AJAX callbacks where this would otherwise be lost.
No. Like notify(), it only triggers progress handlers while the Deferred is pending. Call resolveWith() or resolve() when work finishes successfully.
Yes. resolveWith(context, args) settles with success using a custom this; rejectWith(context, args) settles with failure; notifyWith(context, args) sends interim progress with the same context pattern.
Did you know?
jQuery’s With methods (notifyWith, resolveWith, rejectWith) predate widespread use of arrow functions and lexical this. They let legacy jQuery code pass object context explicitly — the same problem modern code often solves with closures or class fields.