Javascript compiler doesn't respect javascript style

I'm trying to make a wrapper for a javascript library. However I have problems with namespaces in javascript.

For example.

public native object A

  public native class B() {}

val a = A.B()

translates to new B() in javascript and ignores the top-level object.
If B is declared as a function compiler respects the top-level object, but doesn’t call B() with new.

How can I work around this?

By defining name property of native annotation one can define the native side name for a class; example: native(name = "Me.NativeClass") public class NativeClass {}

Please star or vote for to receive news about this.