Hey,
when I was running uTests, there was like 50/50 chance that this code failed on runtime error and I had to do sbt clean to make it work again :
TypeError: undefined is not an object (evaluating 'ScalaJS.c.Lcom_whatever_CharOp.prototype.init___I.call')
which is the moment of CharOp case class new instantiation with Character parameter. If I use Integers instead of Characters, it's OK
trait PressEvent {
def char: Char
}
case class CharOp(char: Char) extends PressEvent
object OpImplicits {
implicit def ToInputOp(char: Char): Op = {
char match {
case 'a' => CharOp(char)
case 'b' => CharOp(char)
case 'c' => CharOp(char)
case x => throw new IllegalArgumentException("Please do not use : " + x)
}
}
implicit def ToInputOps(str: String): Iterable[Op] = str.toCharArray.filterNot(_ == '|').map(ToInputOp)
}
Unfortunately I didn't manage to make a test case that would catch this error, it was just working no matter what I tried when I tried to reproduce it. So I used integers instead.
Now I tried to use Chars again in another case class via fastOptJS the first time the class is instantiated it throws TypeError: undefined is not a function without any further information in Chrome and weird thing is that the second time the class is instantiated it works without any errors... Any idea what it might be ? Sorry that I can't retrieve any more stackTrace, it's just not there.
using scalaJS 0.5.5