Why all the manual run loops?
bf4 opened this issue · 3 comments
bf4 commented
in stripe.js you call Ember.run.begin();
and Ember.run.end()
and I was wondering why you'd want to do that? Isn't that a bit unusual?
function createCardToken (card) {
// manually start Ember loop
Ember.run.begin();
return new Ember.RSVP.Promise(function (resolve, reject) {
Stripe.card.createToken(card, function (status, response) {
if (response.error) {
reject(response);
return Ember.run.end();
}
resolve(response);
Ember.run.end();
});
});
}
function createBankAccountToken(bankAccount) {
// manually start Ember loop
Ember.run.begin();
return new Ember.RSVP.Promise(function (resolve, reject) {
Stripe.bankAccount.createToken(bankAccount, function (status, response) {
if (response.error) {
reject(response);
return Ember.run.end();
}
resolve(response);
Ember.run.end();
});
});
}
buritica commented
bf4 commented
@buritica 1. so sorry I didn't see the other issues. I just looked at pull requests 2. thanks for answering my question! The referenced issues explain it what I was wondering about.
buritica commented
no problem, let us know if you have any issues with this implementation of the run loop, we know it's not ideal :/