jsinterop.annotations

## Annotation Type JsType

-     @Retention(value=RUNTIME)
       @Target(value=TYPE)
       @Documented
      public @interface JsType

  JsType is used to describe the JavaScript API of an object, either one that already exists from the external JavaScript environment, or one that will be accessible from the external JavaScript environment.

  Marking an object with JsType is similar to marking each public member of the class with `JsProperty`/`JsMethod`/`JsConstructor` respectively. In order for this to work correctly the JavaScript name needs to be unique for each member. Some unobvious ways to cause name collisions are:

  - having method or constructor overloads
  - using the same name for a method and a field
  - shadowing a field from parent

  Name collisions must be avoided by providing custom names (e.g. `JsProperty.name()`) or by ignoring members using `JsIgnore`.

  If the JsType is marked as "native" via `isNative()`, then the type is considered a stub for an existing class that is available in native JavaScript. Unlike non-native JsTypes, all members are considered `JsProperty`/`JsMethod`/`JsConstructor` unless they are explicitly marked with `JsOverlay`.

  For native interfaces with no particular JavaScript type associated with them (e.g. structural types) it is recommeded to use `namespace = JsPackage.GLOBAL` and `name = '?'`.

  Instanceof and Castability:

  If the JsType is native, the generated code will try to mimic Javascript semantics.

  All non-native JsTypes will follow regular Java semantics in terms of castability.

  - For concrete native JsTypes, cast checks and instanceof checks will be delegated to the native JavaScript instanceof operator.
  - For interface native JsTypes, instanceof is forbidden and casts to them always succeed.

- - ### Optional Element Summary

    Optional Elements
    Modifier and Type | Optional Element and Description
    --- | ---
    `boolean` | `isNative` Set to `true`, this JsType is a native JavaScript type.
    `java.lang.String` | `name` Customizes the name of the type in generated JavaScript.
    `java.lang.String` | `namespace` Customizes the namespace of the type in generated JavaScript.

- - ### Element Detail

    - #### name

          public abstract java.lang.String name

      Customizes the name of the type in generated JavaScript. If not provided, the simple Java name will be used.
      Default:
        "<auto>"

  - - #### namespace

          public abstract java.lang.String namespace

      Customizes the namespace of the type in generated JavaScript.
      Default:
        "<auto>"

  - - #### isNative

          public abstract boolean isNative

      Set to `true`, this JsType is a native JavaScript type.
      Default:
        false