instructure / ic-ajax

ember-friendly jQuery.ajax wrapper
MIT License
167 stars 29 forks source link

Why do you need to start a Run loop within makeSuccess/makeError? #38

Closed jsangilve closed 9 years ago

jsangilve commented 9 years ago

Hello,

function makeSuccess(resolve) {
  return function(response, textStatus, jqXHR) {
    Ember.run(null, resolve, {
      response: response,
      textStatus: textStatus,
      jqXHR: jqXHR
    });
  }
}

Why is Ember.run needed?

stefanpenner commented 9 years ago

it is best practice to wrap the roots of callstacks in Ember.run this allows us to fill in missing functionality from the native runtime.

jsangilve commented 9 years ago

Thanks @stefanpenner