Class: ServerPageRenderer

ima~ ServerPageRenderer


new ServerPageRenderer(factory, Helper, ReactDOMServer, settings, response, cache)

Initializes the server-side page renderer.

Parameters:
Name Type Description
factory PageRendererFactory

Factory for receive $Utils to view.

Helper vendor.$Helper

The IMA.js helper methods.

ReactDOMServer vendor.ReactDOMServer

React framework instance to use to render the page on the server side.

settings Object.<string, *>

Application setting for the current application environment.

response Response

Utility for sending the page markup to the client as a response to the current HTTP request.

cache Cache

Resource cache caching the results of HTTP requests made by services used by the rendered page.

Members


_cache :Cache

The resource cache, caching the results of all HTTP requests made by the services using by the rendered page. The state of the cache will then be serialized and sent to the client to re-initialize the page at the client side.

Type:

_response :Response

Utility for sending the page markup to the client as a response to the current HTTP request.

Type:

Methods


_getRevivalSettings()

The javascript code will include a settings the "revival" data for the application at the client-side.

Returns:

The javascript code to include into the rendered page.

Type
string

_renderPage(controller, view, pageState, routeOptions)

Render page after all promises from loaded resources is resolved.

Parameters:
Name Type Description
controller AbstractController
view React.Component
pageState Object.<string, *>
routeOptions Object.<string, *>
Returns:
Type
Object

_renderPageContentToString(controller, view, routeOptions)

Render page content to a string containing HTML markup.

Parameters:
Name Type Description
controller AbstractController
view function
routeOptions Object.<string, *>
Returns:
Type
string

_wrapEachKeyToPromise( [dataMap])

Creates a copy of the provided data map object that has the values of its fields wrapped into Promises.

The the values that are already Promises will referenced directly without wrapping then into another Promise.

Parameters:
Name Type Argument Default Description
dataMap Object.<string, *> <optional>
{}

A map of data that should have its values wrapped into Promises.

Returns:

A copy of the provided data map that has all its values wrapped into promises.

Type
Object.<string, Promise>