Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/eta/browser.ts>renderAsync

Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript
Go to Latest
function renderAsync
import { renderAsync } from "https://deno.land/x/eta@v2.2.0/browser.ts";

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

Parameters

template: string | TemplateFunction

Template string or template function

data: object

Data to render the template with

optional
config: PartialConfig

Optional config options

Returns

Promise<string>

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

Parameters

template: string | TemplateFunction

Template string or template function

data: object

Data to render the template with

config: PartialConfig

Optional config options

cb: CallbackFn

Callback function

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

Parameters

template: string | TemplateFunction

Template string or template function

data: object

Data to render the template with

optional
config: PartialConfig

Optional config options

optional
cb: CallbackFn

Callback function

Returns

string | Promise<string> | void