xqhy1q
Last Updated: September 26, 2018
·
1.353K
· fr0gs

Ember.run.later and setTimeout comparing scenario.

In the Ember internals (Backburner) it can be found that Ember.run.later basically calls setTimeout() under the hood, but respecting the firing order by which other timeouts were added into the queue.
More on it on a blog post soon in www.estebansastre.com

import Ember from 'ember';

export default Ember.Controller.extend({
  appName: "Timers comparison",
  init: function() {
    this._super();
    this.set('myErrCountLater', 0);
    this.set('myErrCountTimeout', 0);
    this.myFunc(0);
    this.myOtherFunc(0);
  },
  myFunc: function(errorCount) {
    if (errorCount < 7) {
      self = this;
            this.set('myErrCountLater', errorCount);
        console.log("Error Count Later is " + errorCount + ", repeating");
      Ember.run.later(this, function () {
        return self.myFunc(errorCount+1);
      }, 1500);
    }
    else {
        console.log("Everything failed");
    }
    },
  myOtherFunc: function(errorCount) {
    if (errorCount < 7) {
      self = this;
      this.set('myErrCountTimeout', errorCount)
      console.log("Error Count Timeout is " + errorCount + ", repeating");
      setTimeout(function() {
        return self.myOtherFunc(errorCount + 1);
      }, 1500);
    }
    else {
      console.log("Everything failed");
    }
  }
});

25 Responses
Add your response

29801

Before ember-concurrency, my team would hit this same acceptance-test-runs-forever problem with Ember.run.later. We worked around it by following 1 of 2 suggestions from emberjs/ember.js#3008: we switched to window.setTimeout and wrapped Ember-specific code in its callback in an Ember.run. This was preferable to the other workaround of maintaining test-specific code in app-code. The only drawback was slightly more code and the non-obviousness of using native window methods, when we tend to reach for Ember methods first. ember-concurrency could abstract this away. What would happen if ember-concurrency switched to window.setTimeout + Ember.run under the hood?
https://showbox.onl/
https://vidmate.onl/
https://mobdro.onl/

6 months ago ·
29861
30029

Showbox offers a clean user interface to give an amazing streaming experience. https://show-box.one/

3 months ago ·
30033

The app that checks all the vulnerabilities on your network. check out!!
https://getwpswpatester.com/

3 months ago ·
30048

You can use Ember.run.later like you would normally use setTimeout

Ember.run.later((function() {
//do something in here that will run in 2 seconds
}), 2000);

I'm not sure of the internals, but I know that integration testing Ember requires that you use run.later (if you don't the test code won't wait for the timeout to finish).
https://mobdro.ooo

3 months ago ·
30083
30084

Juniper Bank gives Juniper Credit Card administrations to a portion of the best associations in the United States.https://creditcardlogin.online/juniper-credit-card/

3 months ago ·
30103

<a href="https://vizertv-apk.com">vizer tv apk download</a>

3 months ago ·
30105
30109
3 months ago ·
30110
30211
2 months ago ·
30225

This was preferable to the other workaround of maintaining test-specific code in app-code. The only drawback was slightly more code and the non-obviousness of using native window methods
https://popcorntimeapk.org/

about 2 months ago ·
30244

This article must be very helpful for everyone. It was helpful for me too.

about 2 months ago ·
30248
30367

also visit https://putlockershub.com/ to latest movies stream for free.

about 1 month ago ·
30375

This was preferable to the other workaround of maintaining test-specific code in app-code.
https://snaptube-downloadapp.com/

about 1 month ago ·
30399

download all apk file here descargar apk

https://descargar-apks.com

about 1 month ago ·
30417
30519

Good to see and read this article.. thanks for sharing..

www.terrariumtvforpcwindows.com

28 days ago ·
30633
30736

You can use Ember.run.later like you would normally use setTimeout
The way SetTimeout is normally used, you can use Ember.run.
However, you must try the below mentioned code:-

Ember.run.later((function() {
//do something in here that will run in 2 seconds
}), 2000);

This should work. Let me know if it did.
https://livenettvapk.live

8 days ago ·
30757

Before ember-concurrency, my team would hit this same acceptance-test-runs-forever problem with Ember.run.later. We worked around it by following 1 of 2 suggestions from emberjs/ember.js#3008: we switched to window.setTimeout and wrapped Ember-specific code in its callback in an Ember.run. This was preferable to the other workaround of maintaining test-specific code in app-code. The only drawback was slightly more code and the non-obviousness of using native window methods, when we tend to reach for Ember methods first. ember-concurrency could abstract this away. What would happen if ember-concurrency switched to window.setTimeout + Ember.run under the hood?
https://morpheus-tv.com/

5 days ago ·
30780

Prior to coal simultaneousness, my group would hit this same acknowledgment trials perpetually issue with Ember.run.later.
thanks.
http://tvtapdownloadapp.com/

1 day ago ·
30793

This was preferable to the other workaround of maintaining test-specific code in app-code. The only drawback was slightly more code and the non-obviousness of using native window methods,

http://redboxtvdownloadapp.com/
http://androidpcapps.com/freeflix-hq-apk-install-on-android-windows-roku-fire-tv/

about 3 hours ago ·