-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] configurable setTimeout #163
[FEATURE] configurable setTimeout #163
Conversation
The test failure is simply because |
If we are going to move forward with this, we definitely need tests. |
@rwjblue inline tests to ensure it's a function? Tests to make sure it's configurable? |
@runspired - We need to have tests to ensure that if an alternate is supplied that it is used. |
@rwjblue got it, what should I do about the |
We have to unfortunately assume our consumers also use the same test env. A manual closure to emulate bind should work |
Don't use it 😜
I honestly have no clue if binding a function once and calling many times is faster than Either way, I think we have to avoid assuming |
Before I saw the suggestion to just use a closure (which is now in place) I updated the travis setup to use phantom2, should I revert that or leave it? |
I'd prefer to revert that for now. We can have a separate discussion/PR for that, and I don't want this feature being mired in those arguments. 😸 |
Also, looks like this needs a rebase due to some other changes that landed on master recently. |
👍 |
OK, test is added and build is passing. This generally looks good to me (but I'm no BB expert 😝)... @stefanpenner - Can you review? |
[FEATURE] configurable setTimeout
This PR enables the
setTimeout
instance used bybackburner.js
to be configurable, by modifying the use ofplatform
to also be configurable.The benefit of this is that users can easily switch out the
setTimeout
implementation for smarter implementations built onrequestAnimationFrame
orrequestIdleCallback
.An example use case of this is
ember-run-raf
, which has enabled using backburner withrequestAnimationFrame
via a global override ofsetTimeout
. In using backburner with requestAnimationFrame in this way within Ember applications, nothing but positive results have been noted, with the exception of an issue arisingsocket.io
, which usessetTimeout
during it's socket keep-alive sequence. Work scheduled inrequestAnimationFrame
is paused while tabs are inactive, leadingsocket.io
to close the socket.With this change, the override in ember-run-raf will no longer need to be global, allowing applications which need to use setTimeout for background tasks to continue functioning properly.