Class Renderer

The renderer processes a ProjectReflection using a Theme instance and writes the emitted html documents to a output directory. You can specify which theme should be used using the --theme <name> command line argument.

Renderer is a subclass of EventDispatcher and triggers a series of events while a project is being processed. You can listen to these events to control the flow or manipulate the output.

Hierarchy

  • ChildableComponent<Application, RendererComponent>
    • Renderer

Constructors

Properties

componentName: string

The name of this component as set by the @Component decorator.

Hooks which will be called when rendering pages. Note:

  • Hooks added during output will be discarded at the end of rendering.
  • Hooks added during a page render will be discarded at the end of that page's render.

See RendererHooks for a description of each available hook, and when it will be called.

postRenderAsyncJobs: ((output) => Promise<void>)[] = []

A list of async jobs which must be completed after rendering output files but before generation is considered successful. These functions will be called after all documents have been written to the filesystem.

This may be used by plugins to register work that must be done to finalize output files. For example: asynchronously generating an image referenced in a render hook.

Note: This array is cleared after calling the contained functions on each Renderer.render call.

Type declaration

    • (output): Promise<void>
    • Parameters

      Returns Promise<void>

preRenderAsyncJobs: ((output) => Promise<void>)[] = []

A list of async jobs which must be completed before rendering output. They will be called after RendererEvent.BEGIN has fired, but before any files have been written.

This may be used by plugins to register work that must be done to prepare output files. For example: asynchronously transform markdown to HTML.

Note: This array is cleared after calling the contained functions on each Renderer.render call.

Type declaration

    • (output): Promise<void>
    • Parameters

      Returns Promise<void>

renderStartTime: number = -1
theme?: Theme

The theme that is used to render the documentation.

Accessors

cacheBust
cleanOutputDir
cname
darkTheme
githubPages
lightTheme
pretty
themeName

Methods

  • Type Parameters

    • T extends RendererComponent

    Parameters

    Returns T

  • Define a new theme that can be used to render output. This API will likely be changing at some point, to allow more easily overriding parts of the theme without requiring additional boilerplate.

    Parameters

    Returns void

  • Retrieve a plugin instance.

    Parameters

    • name: string

    Returns undefined | RendererComponent

    The instance of the plugin or undefined if no plugin with the given class is attached.

  • Returns RendererComponent[]

  • Parameters

    • name: string

    Returns boolean

  • Inversion-of-control versions of on. Tell this object to listen to an event in another object... keeping track of what it's listening to for easier unbinding later.

    Parameters

    Returns Renderer

  • Remove one or many callbacks. If context is null, removes all callbacks with that function. If callback is null, removes all callbacks for the event. If name is null, removes all bound callbacks for all events.

    Returns this

  • Parameters

    • eventMap: undefined | EventMap
    • Optional context: any

    Returns this

  • Parameters

    • name: undefined | string
    • Optional callback: EventCallback
    • Optional context: any

    Returns this

  • Bind an event to a callback function. Passing "all" will bind the callback to all events fired.

    Parameters

    Returns this

  • Parameters

    Returns this

  • Parameters

    • name: string
    • callback: EventCallback
    • Optional context: any
    • Optional priority: number

    Returns this

  • Bind an event to only be triggered a single time. After the first time the callback is invoked, its listener will be removed. If multiple events are passed in using the space-separated syntax, the handler will fire once for each event, not once for a combination of all events.

    Parameters

    Returns this

  • Parameters

    • name: string
    • callback: EventCallback
    • Optional context: any
    • Optional priority: any

    Returns this

  • Parameters

    • name: string

    Returns undefined | RendererComponent

  • Render the given project reflection to the specified output directory.

    Parameters

    • project: Models.ProjectReflection

      The project that should be rendered.

    • outputDirectory: string

      The path of the directory the documentation should be rendered to.

    Returns Promise<void>

  • Trigger one or many events, firing all bound callbacks. Callbacks are passed the same arguments as trigger is, apart from the event name (unless you're listening on "all", which will cause your callback to receive the true name of the event as the first argument).

    Parameters

    Returns Renderer

Events

EVENT_BEGIN: "beginRender" = RendererEvent.BEGIN
EVENT_BEGIN_PAGE: "beginPage" = PageEvent.BEGIN
EVENT_END: "endRender" = RendererEvent.END
EVENT_END_PAGE: "endPage" = PageEvent.END
EVENT_PREPARE_INDEX: "prepareIndex" = IndexEvent.PREPARE_INDEX

Generated using TypeDoc