Content renderer
: request
: content
: renderer
: /modules/core/content/services/content-renderer.js
: https://github.com/DecentCMS/DecentCMS/blob/master/modules/core/content/services/content-renderer.js
ContentRenderer()
The ContentRenderer is responsible for the content item rendering lifecycle.
Kind: global function
contentRenderer.promiseToRender(options)
Adds a shape or a content item to the list of shapes for the request.
Kind: instance method of ContentRenderer
| Param | Type | Description |
|---|---|---|
| options | ||
| [options.id] | string |
The id of an item to fetch and add as a shape. |
| [options.shape] | object |
A shape to add to the list of shapes to render. |
| [options.displayType] | string |
The display type to use when rendering the shape. |
contentRenderer.render(context, pageBuilt)
Builds the rendered page from the list of shapes that was prepared so far. This method defines the rendering lifecycle, by emitting events and service calls:
- 'placement-strategy'.placeShapes({shape, shapes, renderStream}, done)
- 'shape-handler'.handle({shape, shapes, renderStream}, done)
- decent.core.register-meta
- decent.core.register-style
- decent.core.register-script
- 'rendering-strategy'.render({shape, shapes, renderStream}, done)
Kind: instance method of ContentRenderer
| Param | Type | Description |
|---|---|---|
| context | ||
| [context.scope] | object |
The scope, which is normally the current request. |
| [context.request] | IncomingMessage |
The request. |
| [context.response] | ServerResponse |
The response. |
| pageBuilt | function |
The function to call when the page has been rendered. |
ContentRenderer.registerMetaEvent
Calls for meta tag registering.
Kind: static property of ContentRenderer
ContentRenderer.registerStyleEvent
Calls for style sheet registering.
Kind: static property of ContentRenderer
ContentRenderer.registerScriptEvent
Calls for script registering.
Kind: static property of ContentRenderer