Base client application.

Hierarchy (view full)

Constructors

Properties

DEV: boolean

Indicates if the application is in dev mode.

initialData: any
LOCALE_COOKIE_NAME: string

Methods

  • Gets the cookie by its name.

    Parameters

    • name: string

    Returns any

  • Gets the code of the default locale.

    Returns string

  • Gets the initial data registered to the app.

    Type Parameters

    • T = any

    Returns T

    T Definition of the returned data.

  • Gets the initial data value by its key.

    Type Parameters

    • T = any

    Parameters

    • key: string

      Key in the initial data.

    Returns T

    T Definition of the returned data.

  • Gets the list of all accepted locales.

    Returns string[]

  • Gets the component registered in the application context.

    Type Parameters

    • T = any

    Parameters

    • key: string

      Key of the reference.

    Returns T

    T Type of the component.

  • Logs the message to the console using console.error if the app is in DEV mode. Also sends log event of the Application. The event is flagged as component: true.

    Parameters

    • message: string
    • Rest...optionalParams: any[]

    Returns void

  • Logs the message to the console using console.error if the app is in DEV mode. Also sends log event of the Application.

    Parameters

    • message: string
    • Rest...optionalParams: any[]

    Returns void

  • Logs the message to the console using console.log if the app is in DEV mode. Also sends log event of the Application.

    Parameters

    • message: string
    • Rest...optionalParams: any[]

    Returns void

  • Logs the message to the console using console.warn if the app is in DEV mode. Also sends log event of the Application.

    Parameters

    • message: string
    • Rest...optionalParams: any[]

    Returns void

  • Pushes the state to the history and renders the route if it's not the current route and refresh is false.

    Parameters

    • path: string

      URL path.

    Returns void

  • Pushes the state to the history and renders the route if it's not the current route and refresh is false.

    Parameters

    • path: string

      URL path.

    • q: {
          [key: string]: string;
      }

      Query string data.

      • [key: string]: string

    Returns void

  • Pushes the state to the history and renders the route if it's not the current route and refresh is false.

    Parameters

    • path: string

      URL path.

    • q: {
          [key: string]: string;
      }

      Query string data.

      • [key: string]: string
    • refresh: boolean

      Indicates if the route should be refreshed if the route is currently rendered.

    Returns void

  • Pushes the state to the history.

    Parameters

    • path: string

      URL path.

    • q: {
          [key: string]: string;
      }

      Query string data.

      • [key: string]: string

    Returns void

  • Alias for the navigate method with the refreshing the content.

    Parameters

    • path: string

      URL path.

    Returns void

  • Alias for the navigate method with the refreshing the content.

    Parameters

    • path: string

      URL path.

    • q: {
          [key: string]: string;
      }

      Query string data.

      • [key: string]: string

    Returns void

  • Forces all registered component to refresh.

    Returns void

  • Registers custom components.

    This method is called automatically in after the bundle load.

    Parameters

    • components: {
          component: Component<{}, {}, any>;
          elementId: string;
      }[]

      List of components.

    Returns this

  • Registers error page for rendering errors.

    This method is called automatically in the bundle load.

    Parameters

    • errorPage: typeof ErrorPage

      ErrorPage component to register.

    Returns this

  • Registers the configuration of locale.

    Parameters

    • defaultLocale: string

      The code of the default locale.

    • accepted: string[]

      List of all accepted locale codes.

    Returns this

  • Registers the routing map.

    This method is called automatically in after the bundle load.

    Parameters

    • routingMap: {
          component: Page<{
              initialData: IInitialDataProps<any>;
              params: any;
              query: any;
          }, {}, any>;
          spec: string;
          title: string;
      }[]

      Map of routes.

    Returns this

  • Registers socket events.

    This method is called automatically in after the bundle load.

    Parameters

    • events: string[]

      List of socket events.

    Returns this

  • Renders the route's component.

    Parameters

    • route: Route

      Route to render.

    Returns void

  • Renders the route's component.

    Parameters

    • route: Route

      Route to render.

    • refresh: boolean

      Indicates if the component of the route should be refreshed if the route is currently rendered.

    Returns void

  • Renders the component to the target.

    Parameters

    • component: Element

      The component.

    • target: HTMLElement

      The target DOM element

    Returns void

  • Renders the component to the target.

    Parameters

    • component: Element

      The component.

    • target: HTMLElement

      The target DOM element

    • callback: (() => void)

      Function called after the render.

        • (): void
        • Returns void

    Returns void

  • Renders the page component.

    Parameters

    • page: Page<{
          initialData: IInitialDataProps<any>;
          params: any;
          query: any;
      }, {}, any>

      Page component.

    Returns void

  • Sets the cookie.

    Parameters

    • name: string

      Name of the cookie.

    • value: any

      Value of the cookie.

    Returns void

  • Sets the cookie.

    Parameters

    • name: string

      Name of the cookie.

    • value: any

      Value of the cookie.

    • options: CookieSetOptions

      Additional options of the cookie.

    Returns void

  • Sets the locale as a dictionary.

    Parameters

    • locale: string

      Locale dictionary to set.

    Returns void

  • Registers the component as the context reference.

    Type Parameters

    • T = any

    Parameters

    • ref: T

      Component's reference.

    • key: string

      Key of the reference.

    Returns void

    T Type of the component.

  • Sets the page title.

    Parameters

    • title: string

      Title of the page.

    Returns void

  • Starts the application.

    This method is called automatically in after the bundle load.

    Returns void