Scala.js support

Closes #26. We'll need to slightly polish (pun intended) this solution later.