Skip to content

Commit

Permalink
Merge pull request #52 from eta-dev/add-exports-to-browse
Browse files Browse the repository at this point in the history
feat: add renderasync to browser
  • Loading branch information
shadowtime2000 authored Nov 29, 2020
2 parents 8dc90f3 + 614df27 commit 34955eb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/browser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export { default as compileToString } from './compile-string'
export { default as compile } from './compile'
export { default as parse } from './parse'
export { default as render } from './render'
export { default as render, renderAsync } from './render'
export { templates } from './containers'
export { config, config as defaultConfig, getConfig, configure } from './config'
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ export { loadFile, renderFile, renderFileAsync, renderFile as __express } from '
export { default as compileToString } from './compile-string'
export { default as compile } from './compile'
export { default as parse } from './parse'
export { default as render } from './render'
export { default as render, renderAsync } from './render'
export { templates } from './containers'
export { config, config as defaultConfig, getConfig, configure } from './config'
3 changes: 2 additions & 1 deletion src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,6 @@ export default function render(
}

export function renderAsync(template: string | TemplateFunction, data: object, config?: PartialConfig, cb?: CallbackFn): string | Promise<string> | void {
return render(template, data, { ...config, async: true }, cb)
// Using Object.assign to lower bundle size, using spread operator makes it larger
return render(template, data, Object.assign({}, config, { async: true }), cb)
}

0 comments on commit 34955eb

Please sign in to comment.