From c535f8dfcebcee4bec2d09712045a8d5d43fab23 Mon Sep 17 00:00:00 2001 From: Chad Hietala Date: Mon, 1 Aug 2016 14:36:47 -0700 Subject: [PATCH] [DOCS] No need to use Ember.run in succes and failure of wrapped getJSON --- addon/adapter.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/addon/adapter.js b/addon/adapter.js index 93407617004..8d199aba585 100644 --- a/addon/adapter.js +++ b/addon/adapter.js @@ -102,10 +102,9 @@ export default Ember.Object.extend({ return new Ember.RSVP.Promise(function(resolve, reject) { Ember.$.getJSON(`/${type.modelName}/${id}`).then(function(data) { - Ember.run(null, resolve, data); + resolve(data); }, function(jqXHR) { - jqXHR.then = null; // tame jQuery's ill mannered promises - Ember.run(null, reject, jqXHR); + reject(jqXHR); }); }); } @@ -134,10 +133,9 @@ export default Ember.Object.extend({ var query = { since: sinceToken }; return new Ember.RSVP.Promise(function(resolve, reject) { Ember.$.getJSON(`/${type.modelName}`, query).then(function(data) { - Ember.run(null, resolve, data); + resolve(data); }, function(jqXHR) { - jqXHR.then = null; // tame jQuery's ill mannered promises - Ember.run(null, reject, jqXHR); + reject(jqXHR); }); }); } @@ -165,10 +163,9 @@ export default Ember.Object.extend({ query: function(store, type, query) { return new Ember.RSVP.Promise(function(resolve, reject) { Ember.$.getJSON(`/${type.modelName}`, query).then(function(data) { - Ember.run(null, resolve, data); + resolve(data); }, function(jqXHR) { - jqXHR.then = null; // tame jQuery's ill mannered promises - Ember.run(null, reject, jqXHR); + reject(jqXHR); }); }); } @@ -204,10 +201,9 @@ export default Ember.Object.extend({ queryRecord: function(store, type, query) { return new Ember.RSVP.Promise(function(resolve, reject) { Ember.$.getJSON(`/${type.modelName}`, query).then(function(data) { - Ember.run(null, resolve, data); + resolve(data); }, function(jqXHR) { - jqXHR.then = null; // tame jQuery's ill mannered promises - Ember.run(null, reject, jqXHR); + reject(jqXHR); }); }); }