1 | import { Renderer, IRendererOptions } from './renderer';
|
2 | import { ITokenizeOptions } from './tokenize';
|
3 | /**
|
4 | * The options that customize the tokenization of the template and the renderer
|
5 | * object that is returned
|
6 | */
|
7 | export interface ICompileOptions extends IRendererOptions, ITokenizeOptions {
|
8 | }
|
9 | /**
|
10 | * Compiles a template and returns an object with functions that render it.
|
11 | * Compilation makes repeated render calls more optimized by parsing the
|
12 | * template only once and reusing the results.
|
13 | * As a result, rendering gets 3-5x faster.
|
14 | * Caching is stored in the resulting object, so if you free up all the
|
15 | * references to that object, the caches will be garbage collected.
|
16 | *
|
17 | * @param template same as the template parameter to .render()
|
18 | * @param options some options for customizing the compilation
|
19 | * @throws `TypeError` if the template is not a string
|
20 | * @throws `TypeError` if the options is set but is not an object
|
21 | * @throws any error that [[tokenize]] or [[Renderer.constructor]] may throw
|
22 | * @returns a [[Renderer]] object which has render methods
|
23 | */
|
24 | export declare function compile(template: string, options?: ICompileOptions): Renderer;
|