-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove hard dependency on jQuery.Deferred quirks
jQuery.Deferred objects are not compliant with the Promises/A+ standard. Replaces Promise#done() (not part of the standard) with Promises#then() This fixes the jQuery.Deffered dependency discussed in #980. It also exposes Marionette.Deferred as a means to configure the desired implementation. e.g. ``` Backbone.Marionette.Deferred = Q.defer; // kriskowal/q Backbone.Marionette.Deferred = when.defer; // cujojs/when ```
- Loading branch information
Showing
6 changed files
with
84 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Marionette Configuration | ||
|
||
Marionette has a few globally configurable settings that will | ||
change how the system works. While many of these subjects are covered | ||
in other docs, this configuration doc should provide a list of the | ||
most common items to change. | ||
|
||
## Documentation Index | ||
|
||
* [Marionette.Deferred](#deferred) | ||
|
||
## Marionette.Deferred <a name="deferred"></a> | ||
|
||
By default, Marionette makes use of `Backbone.$.Deferred` to create | ||
thenable objects. All that is needed is a Deferred that has the | ||
following properties: | ||
|
||
1. `promise`: a Promises/A+ thenable, or a function that returns one | ||
2. `resolve`: a function that resolves the provided promise with a value | ||
|
||
For example: | ||
|
||
```js | ||
var deferred = Marionette.Deferred(); | ||
|
||
_.result(deferred, 'promise').then(function (target) { | ||
console.log("Hello, " + target + "!"); | ||
}); | ||
|
||
deferred.resolve("world"); // asynchronous "Hello, world!" | ||
``` | ||
|
||
If you wish to use a specific promise library, you can override the default via: | ||
|
||
```js | ||
Marionette.Deferred = myDeferredLib; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters