Skip to content

Instantly share code, notes, and snippets.

@hergaiety
Created January 24, 2018 14:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hergaiety/80372023ad1210f73d98e5d0ab361d00 to your computer and use it in GitHub Desktop.
Save hergaiety/80372023ad1210f73d98e5d0ab361d00 to your computer and use it in GitHub Desktop.
Leveraging async/await for the Ember runloop, simply.
const emberRunloop = (queue = 'sync') => new Promise(resolve => {
scheduleOnce(queue, () => {
resolve();
});
});
export default Component.extend({
async _myFunction() {
await emberRunloop('afterRender');
// Do your stuff after above specified ember runloop
// https://guides.emberjs.com/v2.18.0/applications/run-loop/#toc-toggle
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment