bringapp
    Preparing search index...

    Function initServer

    • Initializes Bring Blocks functions that should be run on the server.

      Type Parameters

      • SP = object

        SiteProps

      • M = object

        Menu

      • MI = object

        MenuItem

      Parameters

      • wpURL: string = ""

        The WordPress URL.

      Returns {
          DynamicEntity: <T = object, P = object>(
              props: EntityProps<T, P>,
          ) => Promise<null | Element>;
          DynamicEntityList: <T = {}, P = {}>(
              props: DynamicEntityListProps<T, P>,
          ) => Promise<null | Element>;
          getDynamicEntityList: <T = object, P = object>(
              entitySlug: string,
              entityType: EntityType,
              options?: GetDynamicEntityListOptions,
          ) => Promise<
              | {
                  entityList: DynamicEntityList<T>;
                  params: GetDynamicEntityListParams<P>;
              }
              | { entityList: null; params: GetDynamicEntityListParams<P> },
          >;
          getDynamicEntityProps: <T = object, P = object>(
              entityId: number,
              entityType: EntityType,
              options?: GetDynamicEntityPropsOptions,
          ) => Promise<
              | { entityProps: DynamicEntityProps<T>; params: P }
              | { entityProps: null; params: P },
          >;
          getSiteProps: () => Promise<null | SiteProps<SP, M, MI>>;
      }

      An object containing functions to retrieve dynamic entity props, dynamic entity list, and site props.

      • DynamicEntity: <T = object, P = object>(props: EntityProps<T, P>) => Promise<null | Element>

        Renders the dynamic entity on the server with the given render function.

      • DynamicEntityList: <T = {}, P = {}>(props: DynamicEntityListProps<T, P>) => Promise<null | Element>

        Renders the dynamic entity list on the server with the given render function.

      • getDynamicEntityList: <T = object, P = object>(
            entitySlug: string,
            entityType: EntityType,
            options?: GetDynamicEntityListOptions,
        ) => Promise<
            | {
                entityList: DynamicEntityList<T>;
                params: GetDynamicEntityListParams<P>;
            }
            | { entityList: null; params: GetDynamicEntityListParams<P> },
        >

        Retrieves a list of dynamic entities.

      • getDynamicEntityProps: <T = object, P = object>(
            entityId: number,
            entityType: EntityType,
            options?: GetDynamicEntityPropsOptions,
        ) => Promise<
            | { entityProps: DynamicEntityProps<T>; params: P }
            | { entityProps: null; params: P },
        >

        Retrieves the properties of a dynamic entity.

      • getSiteProps: () => Promise<null | SiteProps<SP, M, MI>>

        Retrieves the properties of the site.