• Register the projection to the server.

    Type Parameters

    • View

    Parameters

    • server: Server

      The server to register the projection model on.

    • domain: string

      The domain of the projection model.

    • model: ProjectionModel<unknown, View>

      The model to register.

    Returns {
        dispatch: ((dispatcher, action, optimisticId?) => {
            error: unknown;
            success: false;
        } | {
            success: true;
        });
        projection: ((dispatcher) => View);
        unregister: (() => void);
    }

    An object with methods to unregister, and get projections and to dispatch actions to the model.

    • dispatch: ((dispatcher, action, optimisticId?) => {
          error: unknown;
          success: false;
      } | {
          success: true;
      })
        • (dispatcher, action, optimisticId?): {
              error: unknown;
              success: false;
          } | {
              success: true;
          }
        • Parameters

          • dispatcher: string
          • action: Message
          • Optional optimisticId: string

          Returns {
              error: unknown;
              success: false;
          } | {
              success: true;
          }

    • projection: ((dispatcher) => View)

      Get projection for a specific user.

        • (dispatcher): View
        • Get projection for a specific user.

          Parameters

          • dispatcher: string

          Returns View

    • unregister: (() => void)

      Unregister this model from the server.

        • (): void
        • Unregister this model from the server.

          Returns void