Skip to content

Commit

Permalink
Don't depend on $.Deferred in closing
Browse files Browse the repository at this point in the history
  • Loading branch information
megawac committed Jan 7, 2015
1 parent 371e182 commit f612748
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions backbone-indexeddb.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

if ( _(indexedDB).isUndefined() ) { return; }

var Deferred = Backbone.$ && Backbone.$.Deferred;

// Driver object
// That's the interesting part.
// There is a driver for each schema provided. The schema is a te combination of name (for the database), a version as well as migrations to reach that
Expand Down Expand Up @@ -568,7 +570,7 @@
});
// Clean up active databases object.
Databases = {};
return Backbone.$.Deferred().resolve();
return Deferred && Deferred().resolve();
}

// If a model or a collection does not define a database, fall back on ajaxSync
Expand All @@ -585,8 +587,8 @@
}

var dfd, promise;
if (typeof $ != 'undefined' && $.Deferred) {
dfd = $.Deferred();
if (Deferred) {
dfd = Deferred();
promise = dfd.promise();
promise.abort = function () {
options.abort = true;
Expand Down

0 comments on commit f612748

Please sign in to comment.