Class PhotonJS

java.lang.Object
com.helger.photon.app.html.PhotonJS

@ThreadSafe public final class PhotonJS extends Object
This class keeps track of all the JS files that must be included globally for a single request.
Author:
Philip Helger
  • Field Details

  • Method Details

    • _readJSIncludes

      public static void _readJSIncludes(@Nonnull com.helger.commons.io.resource.IReadableResource aRes, @Nonnull JSResourceSet aTarget)
    • readJSIncludesForGlobal

      public static void readJSIncludesForGlobal(@Nonnull com.helger.commons.io.resource.IReadableResource aRes)
    • registerJSIncludeForGlobal

      public static void registerJSIncludeForGlobal(@Nonnull com.helger.html.resource.js.IJSPathProvider aJSPathProvider)
      Register a new JS item for global scope.
      Parameters:
      aJSPathProvider - The JS path provider to use. May not be null.
    • registerJSIncludeForGlobal

      public static void registerJSIncludeForGlobal(int nIndex, @Nonnull com.helger.html.resource.js.IJSPathProvider aJSPathProvider)
      Register a new JS item for global scope.
      Parameters:
      nIndex - The index to be used. If the value is < 0 the value is ignored and item is appended.
      aJSPathProvider - The JS path provider to use. May not be null.
    • unregisterJSIncludeForGlobal

      public static void unregisterJSIncludeForGlobal(@Nonnull com.helger.html.resource.js.IJSPathProvider aJSPathProvider)
      Unregister an existing JS item for global scope.
      Parameters:
      aJSPathProvider - The JS path provider to use. May not be null.
    • unregisterAllJSIncludesFromGlobal

      public static void unregisterAllJSIncludesFromGlobal()
      Unregister all existing JS items from global scope.
    • getAllRegisteredJSIncludesForGlobal

      @Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsOrderedSet<com.helger.html.resource.js.IJSPathProvider> getAllRegisteredJSIncludesForGlobal()
      Returns:
      A non-null set with all JS paths to be included globally.
    • getAllRegisteredJSIncludesForGlobal

      public static void getAllRegisteredJSIncludesForGlobal(@Nonnull Collection<? super com.helger.html.resource.js.IJSPathProvider> aTarget)
    • hasRegisteredJSIncludesForGlobal

      public static boolean hasRegisteredJSIncludesForGlobal()
      Returns:
      true if at least a single JS path has been registered globally.
    • registerJSIncludeForThisRequest

      public static void registerJSIncludeForThisRequest(@Nonnull com.helger.html.resource.js.IJSPathProvider aJSPathProvider)
      Register a new JS item only for this request
      Parameters:
      aJSPathProvider - The JS path provider to use. May not be null.
    • unregisterJSIncludeFromThisRequest

      public static void unregisterJSIncludeFromThisRequest(@Nonnull com.helger.html.resource.js.IJSPathProvider aJSPathProvider)
      Unregister a existing JS item only from this request
      Parameters:
      aJSPathProvider - The JS path provider to use. May not be null.
    • unregisterAllJSIncludesFromThisRequest

      public static void unregisterAllJSIncludesFromThisRequest()
      Unregister all existing JS items from this request
    • getAllRegisteredJSIncludesForThisRequest

      @Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsOrderedSet<com.helger.html.resource.js.IJSPathProvider> getAllRegisteredJSIncludesForThisRequest()
      Returns:
      A non-null set with all JS paths to be included in this request.
    • getAllRegisteredJSIncludesForThisRequest

      public static void getAllRegisteredJSIncludesForThisRequest(@Nonnull Collection<? super com.helger.html.resource.js.IJSPathProvider> aTarget)
    • hasRegisteredJSIncludesForThisRequest

      public static boolean hasRegisteredJSIncludesForThisRequest()
      Returns:
      true if at least a single JS path has been registered for this request only