Enum Class JavaScript.Type

java.lang.Object
java.lang.Enum<JavaScript.Type>
com.vaadin.flow.component.dependency.JavaScript.Type
All Implemented Interfaces:
Serializable, Comparable<JavaScript.Type>, Constable
Enclosing class:
JavaScript

public static enum JavaScript.Type extends Enum<JavaScript.Type>
The kind of <script> tag to render for the dependency.
  • Enum Constant Details

    • SCRIPT

      public static final JavaScript.Type SCRIPT
      Render a classic <script> tag. Functions declared in the loaded file become available in the global scope.
    • MODULE

      public static final JavaScript.Type MODULE
      Render a <script type="module"> tag. The loaded file is treated as an ES module: functions and variables declared in it are private to the module unless explicitly exported. The file is loaded at runtime and is not bundled, even when the URL is a bare relative path. Use this for hand-authored or CDN-hosted modules that should not go through Vite. For build-time bundled ES modules use JsModule instead.

      LoadMode.EAGER and LoadMode.LAZY are supported; LoadMode.INLINE is not, as the browser cannot be given the contents of a module without also losing the module's identity. Use SCRIPT if the contents must be inlined into the page.

  • Method Details

    • values

      public static JavaScript.Type[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static JavaScript.Type valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null