Skip to content

Commit

Permalink
Merge pull request #443 from rwjblue/fix-microtask-progression
Browse files Browse the repository at this point in the history
Fix RSVP.Promise overriding Promise in native promise detection.
  • Loading branch information
rwjblue committed Oct 23, 2018
2 parents 1d8c5e4 + 90abeda commit f35630b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions addon-test-support/@ember/test-helpers/-utils.js
@@ -1,15 +1,16 @@
import { Promise } from 'rsvp';
/* globals Promise */
import { Promise as RSVPPromise } from 'rsvp';

export const nextTick =
typeof Promise === 'undefined' ? setTimeout : cb => Promise.resolve().then(cb);
export const futureTick = setTimeout;

/**
@private
@returns {Promise<void>} promise which resolves on the next turn of the event loop
@returns {Promise<void>} Promise which can not be forced to be ran synchronously
*/
export function nextTickPromise() {
return new Promise(resolve => {
return new RSVPPromise(resolve => {
nextTick(resolve);
});
}
Expand Down

0 comments on commit f35630b

Please sign in to comment.