Skip to content

Instantly share code, notes, and snippets.

@gavacho
Created March 4, 2014 19:40
Show Gist options
  • Save gavacho/9354006 to your computer and use it in GitHub Desktop.
Save gavacho/9354006 to your computer and use it in GitHub Desktop.
EmberRunPromise = function(resolver, name) {
return new Ember.RSVP.Promise(function(resolve, reject) {
resolver(wrapInRun(resolve), wrapInRun(reject));
}, name);
}
function wrapInRun(fn) {
return function() {
var context = this;
var args = [].prototype.slice.apply(arguments);
Ember.run(function() {
fn.apply(context, args);
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment