com.vaadin.flow.component.dependency.

Annotation Type JavaScript


  • @Retention(value=RUNTIME)
     @Target(value=TYPE)
     @Documented
     @Repeatable(value=JavaScript.Container.class)
    public @interface JavaScript

    Defines JavaScript dependencies on a Component class. For adding multiple JavaScript files for a single component, you can use this annotation multiple times.

    It is guaranteed that dependencies will be loaded only once.

    NOTE: while this annotation is not inherited using the @Inherited annotation, the annotations of the possible parent components or implemented interfaces are read when sending the dependencies to the browser.

    Since:

    1.0

    Author:

    Vaadin Ltd

    • Required Element Summary

      Required Elements
      Modifier and Type Required Element and Description
      String value

      JavaScript file URL to load before using the annotated Component in the browser.

    • Optional Element Summary

      Optional Elements
      Modifier and Type Optional Element and Description
      LoadMode loadMode

      Determines the dependency load mode.

    • Element Detail

      • value

        public abstract String value

        JavaScript file URL to load before using the annotated Component in the browser.

        Relative URLs are interpreted as relative to the configured frontend directory location. You can prefix the URL with context:// to make it relative to the context path or use an absolute URL to refer to files outside the frontend directory.

        Returns:

        a JavaScript file URL

      • loadMode

        public abstract LoadMode loadMode

        Determines the dependency load mode. Refer to LoadMode for the details.

        Returns:

        load mode for the dependency

        Default:

        com.vaadin.flow.shared.ui.LoadMode.EAGER