Plumile JS API
    Preparing search index...

    Function getResourcePage

    • Factory function to create or retrieve a cached ResourcePage instance. This function implements a singleton pattern per moduleId to ensure that the same component is not loaded multiple times.

      Parameters

      • moduleId: string

        Globally unique identifier for the resource used for caching

      • loader: ResourcePageLoader

        Function that returns a Promise resolving to the component

      Returns ResourcePage | null

      ResourcePage instance (cached if previously created)

      // Create a resource for lazy loading
      const resource = getResourcePage('UserProfile', () => import('./UserProfile'));
      resource.load();

      // In a React component with Suspense boundary:
      const UserProfile = resource.read();
      return <UserProfile userId={userId} />;