Skip to content
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

Warn if falling back to setTimeout in dev mode #51

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package org.scalajs.macrotaskexecutor

import scala.collection.mutable
import scala.concurrent.{ExecutionContext, ExecutionContextExecutor}
import scala.scalajs.LinkingInfo
import scala.scalajs.js
import scala.util.Random
import scala.util.control.NonFatal
Expand Down Expand Up @@ -152,6 +153,13 @@ object MacrotaskExecutor extends ExecutionContextExecutor {
// we don't try to look for process.nextTick since scalajs doesn't support old node
// we're also not going to bother fast-pathing for IE6; just fall through

if (LinkingInfo.developmentMode) {
if (js.typeOf(js.Dynamic.global.console) != Undefined && js.typeOf(js.Dynamic.global.console.warn) != Undefined)
js.Dynamic.global.console.warn(
"Unable to polyfill setImmediate() in this environment so falling back to setTimeout(); this may affect performance. " +
"See https://github.com/scala-js/scala-js-macrotask-executor for more information.")
}
Comment on lines +156 to +161
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to balance being helpful/informative without being too alarmist, since this is still a correct implementation.


{ k =>
js.Dynamic.global.setTimeout(k, 0)
()
Expand Down