title: Futures in Scala.js
body: <p>I tried to use Promises and Futures in Scala.js. Promise works, as soon as it comes to Futures I get warnings and errors. </p>
  
  <p>Try:</p>
  
  <pre><code>val p1 = Promise[Int]
  val f1: Future[Int] = p1.future
  val p2 = Promise[Int]
  val f2: Future[Int] = p2.future
  
  val res1 =  for {
     v1 &lt;- f1
     v2 &lt;- f2
  } yield v1 + v2
  
  
  val res2 = f1.flatMap(x =&gt; f2.map(y =&gt; x + y))
  
  
  
  res1 onSuccess {
    case x: Int =&gt; g.console.log(x);
  
  }
  
  res2 onSuccess {
    case x: Int =&gt; g.console.log(x);
  
  }
  
  // callback in dom, using ScalaTags
  // div(`class` := "btn  btn-default", `type` := "button", onclick := click(1, p1))
  def click(i: Int, p: Promise[Int])(x: dom.MouseEvent): Unit = {
    g.console.log(i);
    try {
      p success i
    }
    catch {
      case x: Throwable =&gt; println("again")
    }
  }
  
  f1 onSuccess {
    case x: Int =&gt; 1
  
  }
  </code></pre>
  
  <p>And I get in sbt fastOptJs:</p>
  
  <pre><code>[warn] Referring to non-existent class jl_Thread$UncaughtExceptionHandler
  [warn]   called from s_concurrent_impl_ExecutionContextImpl.init___ju_concurrent_Executor__F1
  [warn]   called from s_concurrent_impl_ExecutionContextImpl$.fromExecutor__ju_concurrent_Executor__F1__s_concurrent_impl_ExecutionContextImpl
  [warn]   called from s_concurrent_ExecutionContext$Implicits$.global$lzycompute__p1__s_concurrent_ExecutionContextExecutor
  [warn]   called from s_concurrent_ExecutionContext$Implicits$.global__s_concurrent_ExecutionContextExecutor
  [warn]   called from Lexample_H2$class.Lexample_H2$class__$init$__Lexample_H2__V
  [warn] 
  </code></pre>
  
  <p>And I get in the browser:</p>
  
  <pre><code>uncaught exception: java.lang.RuntimeException: System.getProperty() not implemented
  </code></pre>
  
  <p>What is missing/unimplemented? How can I implement it? Is there a workaround? 
  How can I implement an ExecutionContext that is makes sense to handle Events withing the browser?</p>