Annotation Interface JS.Export
- Enclosing class:
JS
Denotes that the annotated Java class should be exported from the VM class. The annotated
class must be a subclass of the
JSObject
class.
A JSObject
subclass may not be included in the image if the closed-world analysis
concludes that the class is not used by the Java code of the application. However, exported
JSObject
subclasses are always included in the image, and are accessible from the
JavaScript code (see JSObject
documentation).
Exported classes should be used with care. Since these classes and all their methods are
unconditionally included in the image, this annotation should only be used in cases in which
the class is supposed to be instantiated from JavaScript. If the JSObject
subclass is only instantiated in Java and passed to JavaScript, then there is no need to use
the JS.Export
annotation. Furthermore, the authors of exported classes should reduce
the amount of code that is reachable from the methods of an exported class.