Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Renderer

The renderer processes a ProjectReflection using a [[BaseTheme]] 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.

Subclasses of [[BasePlugin]] that have registered themselves in the [[Renderer.PLUGIN_CLASSES]] will be automatically initialized. Most of the core functionality is provided as separate plugins.

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.

  • [[Renderer.EVENT_BEGIN]]
    Triggered before the renderer starts rendering a project. The listener receives an instance of [[RendererEvent]]. By calling [[RendererEvent.preventDefault]] the entire render process can be canceled.

    • [[Renderer.EVENT_BEGIN_PAGE]]
      Triggered before a document will be rendered. The listener receives an instance of [[PageEvent]]. By calling [[PageEvent.preventDefault]] the generation of the document can be canceled.

    • [[Renderer.EVENT_END_PAGE]]
      Triggered after a document has been rendered, just before it is written to disc. The listener receives an instance of [[PageEvent]]. When calling [[PageEvent.preventDefault]] the the document will not be saved to disc.

  • [[Renderer.EVENT_END]]
    Triggered after the renderer has written all documents. The listener receives an instance of [[RendererEvent]].

Hierarchy

  • ChildableComponent<Application, RendererComponent>
    • Renderer

Index

Constructors

constructor

  • Create new Component instance.

    Parameters

    Returns Renderer

Properties

componentName

componentName: string

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

disableOutputCheck

disableOutputCheck: boolean

gaID

gaID: string

gaSite

gaSite: string

hideGenerator

hideGenerator: boolean

highlightTheme

highlightTheme: Theme

Private prepareOutputDirectory

prepareOutputDirectory: any

Prepare the output directory. If the directory does not exist, it will be created. If the directory exists, it will be emptied.

param

The path to the directory that should be prepared.

returns

TRUE if the directory could be prepared, otherwise FALSE.

Private prepareTheme

prepareTheme: any

Ensure that a theme has been setup.

If a the user has set a theme we try to find and load it. If no theme has been specified we load the default theme.

returns

TRUE if a theme has been setup, otherwise FALSE.

Private renderDocument

renderDocument: any

Render a single page.

param

An event describing the current page.

returns

TRUE if the page has been saved to disc, otherwise FALSE.

Optional theme

theme: Theme

The theme that is used to render the documentation.

themeName

themeName: string

toc

toc: string[]

Accessors

Private _listenId

  • get _listenId(): any
  • A unique id that identifies this instance.

    Returns any

application

  • Return the application / root component instance.

    Returns Application

owner

  • get owner(): O
  • Return the owner of this component.

    Returns O

Methods

addComponent

  • addComponent<T>(name: string, componentClass: T | ComponentClass<T, Application>): T
  • Type parameters

    • T: RendererComponent<T>

    Parameters

    • name: string
    • componentClass: T | ComponentClass<T, Application>

    Returns T

Protected bubble

  • bubble(name: string | Event | EventMap, ...args: any[]): Renderer
  • Parameters

    • name: string | Event | EventMap
    • Rest ...args: any[]

    Returns Renderer

getComponent

  • getComponent(name: string): RendererComponent
  • Retrieve a plugin instance.

    Parameters

    • name: string

    Returns RendererComponent

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

getComponents

  • getComponents(): RendererComponent[]
  • Returns RendererComponent[]

getDefaultTheme

  • getDefaultTheme(): string
  • Returns string

hasComponent

  • hasComponent(name: string): boolean
  • Parameters

    • name: string

    Returns boolean

Protected initialize

  • initialize(): void
  • Initialize this component.

    Returns void

listenTo

  • 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

    • obj: EventDispatcher
    • name: string | EventMap
    • Optional callback: EventCallback
    • Optional priority: number

    Returns Renderer

listenToOnce

  • Inversion-of-control versions of once.

    Parameters

    Returns Renderer

  • Parameters

    • obj: EventDispatcher
    • name: string
    • callback: EventCallback
    • Optional priority: number

    Returns Renderer

off

  • off(): Renderer
  • off(eventMap: EventMap, context?: any): Renderer
  • off(name: string, callback?: EventCallback, context?: any): 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 Renderer

  • Parameters

    • eventMap: EventMap
    • Optional context: any

    Returns Renderer

  • Parameters

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

    Returns Renderer

on

  • on(eventMap: EventMap, context?: any): Renderer
  • on(eventMap: EventMap, callback?: EventCallback, context?: any, priority?: number): Renderer
  • on(name: string, callback: EventCallback, context?: any, priority?: number): Renderer
  • Bind an event to a callback function. Passing "all" will bind the callback to all events fired.

    Parameters

    • eventMap: EventMap
    • Optional context: any

    Returns Renderer

  • Parameters

    • eventMap: EventMap
    • Optional callback: EventCallback
    • Optional context: any
    • Optional priority: number

    Returns Renderer

  • Parameters

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

    Returns Renderer

once

  • once(eventMap: EventMap, context?: any): Renderer
  • once(name: string, callback: EventCallback, context?: any, priority?: any): Renderer
  • 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

    • eventMap: EventMap
    • Optional context: any

    Returns Renderer

  • Parameters

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

    Returns Renderer

removeAllComponents

  • removeAllComponents(): void
  • Returns void

removeComponent

  • removeComponent(name: string): RendererComponent
  • Parameters

    • name: string

    Returns RendererComponent

render

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

    Parameters

    • project: ProjectReflection

      The project that should be rendered.

    • outputDirectory: string

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

    Returns Promise<void>

stopListening

  • Tell this object to stop listening to either specific events ... or to every object it's currently listening to.

    Parameters

    • Optional obj: EventDispatcher
    • Optional name: string | EventMap
    • Optional callback: EventCallback

    Returns Renderer

trigger

  • trigger(name: string | Event | EventMap, ...args: any[]): Renderer
  • 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

    • name: string | Event | EventMap
    • Rest ...args: any[]

    Returns Renderer

Static getDefaultTheme

  • getDefaultTheme(): string
  • Return the path to the default theme.

    Returns string

    The path to the default theme.

Static getThemeDirectory

  • getThemeDirectory(): string
  • Return the path containing the themes shipped with TypeDoc.

    Returns string

    The path to the theme directory.

Generated using TypeDoc