Tweaks to avoid missing implems in Scala.js.
Yeehah! Port to Scala.js. Now it works in browsers!