TagRenderer

A simple renderer for template from ES6 template literals

Constructors

  • Parameters

    • options: {
          insertTokenIds?: boolean;
          routeOptions?: any;
          templateTags: any[];
          tokenHandlers?: Function | Function[];
      }
      • Optional insertTokenIds?: boolean
      • Optional routeOptions?: any
      • templateTags: any[]
      • Optional tokenHandlers?: Function | Function[]

    Returns TagRenderer

Properties

_handlerContext: any
_handlersMap: {}

Type declaration

    _options: any
    _processor: RenderProcessor
    _template: TagTemplate
    _tokenHandlers: any[]
    _tokenIdLookupMap: {}

    Type declaration

      _tokens: any[]

      Methods

      • Parameters

        • handlers: any

        Returns void

      • Add a handler to provide token IDs for the template but will not invoke it yet

        Parameters

        • name: string

          name of token ids

        • handler: Function

          handler function

        • Optional priority: number

          higher value === higher priority

        Returns void

      • Initialize to get ready to do rendering

        Parameters

        • Optional reset: boolean

          if true, will run even if already initialized

        Returns void

      • Lookup the handler of a tag

        Parameters

        • tk: any

          tag

        Returns any

      • Register a handler to provide token IDs for the template

        Parameters

        • name: string

          name of token ids

        • uniqSym: symbol

          unique symbol identifier

        • handler: Function

          handler function

        • Optional priority: number

          higher value === higher priority

        Returns void

      • Render the template

        Parameters

        • options: any

          render context options

        Returns Promise<any>

        render context