Skip to content

Commit

Permalink
docs: docs jsdoc for renderasync
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowtime2000 committed Dec 15, 2020
1 parent d6ca393 commit aeac178
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function handleCache(template: string | TemplateFunction, options: EtaConfig): T
* If `config.async` is `false`, Eta will return the rendered template.
*
* If `config.async` is `true` and there's a callback function, Eta will call the callback with `(err, renderedTemplate)`.
* If `config.async` is `true` and there's not a callback function, Eta will return a Promise that resolves to the rendered template
* If `config.async` is `true` and there's not a callback function, Eta will return a Promise that resolves to the rendered template.
*
* If `config.cache` is `true` and `config` has a `name` or `filename` property, Eta will cache the template on the first render and use the cached template for all subsequent renders.
*
Expand Down Expand Up @@ -84,6 +84,21 @@ export default function render(
}
}

/**
* Render a template asynchronously
*
* If `template` is a string, Eta will compile it to a function and call it with the provided data.
* If `template` is a function, Eta will call it with the provided data.
*
* If there is a callback function, Eta will call it with `(err, renderedTemplate)`.
* If there is not a callback function, Eta will return a Promise that resolves to the rendered template
*
* @param template Template string or template function
* @param data Data to render the template with
* @param config Optional config options
* @param cb Callback function
*/

export function renderAsync(
template: string | TemplateFunction,
data: object,
Expand Down

0 comments on commit aeac178

Please sign in to comment.