Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] No need to use Ember.run in succes and failure of wrapped getJSON #4490

Merged
merged 1 commit into from
Aug 4, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions addon/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolve(Ember.$.getJSON(/${type.modelName}/${id})) would also be the same.

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);
});
});
}
Expand Down Expand Up @@ -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);
});
});
}
Expand Down Expand Up @@ -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);
});
});
}
Expand Down Expand Up @@ -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);
});
});
}
Expand Down