• Preparing search index...
  • The search index is not available
Remix Utils - v8.7.0
  • Remix Utils
  • Middleware/Singleton
  • unstable_createSingletonMiddleware

Function unstable_createSingletonMiddleware

  • unstable_createSingletonMiddleware<T>(
        options: unstable_createSingletonMiddleware.Options<T>,
    ): unstable_createSingletonMiddleware.ReturnType<T>

    Creates a singleton middleware that creates an instance of an object and stores it in the context. If the instance already exists in the context, it will return the existing instance.

    Type Parameters

    • T

    Parameters

    • options: unstable_createSingletonMiddleware.Options<T>

      Options for the singleton middleware.

      • instantiator:function
        • instantiator(request: Request, context: unstable_RouterContextProvider): T

          Parameters

          • request: Request
          • context: unstable_RouterContextProvider

          Returns T

          • Defined in src/server/middleware/singleton.ts:122

    Returns unstable_createSingletonMiddleware.ReturnType<T>

    A tuple containing the middleware function and a function to get the singleton instance from the context.

    • Defined in src/server/middleware/singleton.ts:99

Settings

Member Visibility
Remix Utils - v8.7.0
  • Loading...

Generated using TypeDoc