blob: 1f2ee6f3c3c0b011ef158f49706cd46c18cfd097 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package scala.scalajs.concurrent
import scala.concurrent.ExecutionContext
import scalajs.js
private[concurrent] object QueueExecutionContext extends ExecutionContext {
def execute(runnable: Runnable) = {
val lambda: js.Function = () =>
try { runnable.run() } catch { case t: Throwable => reportFailure(t) }
js.Dynamic.global.setTimeout(lambda, 0)
}
def reportFailure(t: Throwable) =
Console.err.println("Failure in async execution: " + t)
}
|