Reputation: 1639
It seems that exporting abstract val/var with descendants like this doesn't work:
@JSExportDescendentObjects
trait T {
@JSExport
val i: Int
@JSExport
var j: Int
}
class A extends T {
val i = 5
var j = 10
}
I get warnings no valid targets for annotation on value i - it is discarded unused
and A
's i
and j
are not seen from Javascript. However, it is possible to export them via @JSExportAll
:
@JSExportDescendentObjects
@JSExportAll
trait T {
val i: Int
var j: Int
}
class A extends T {
val i = 5
var j = 10
}
It is fine now, no warnings and i
and j
are visible from JS.
def
s doesn't have such problem. Why is this and how can I selectively export abstract val/var?
Upvotes: 2
Views: 91