Package Exports
- handlebars-async-helpers
- handlebars-async-helpers/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (handlebars-async-helpers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Handlebars Async Helpers
Library that adds support to asynchronous function helpers to handlebars lib.
How to install
npm install handlebars-async-helpersHow to use
const handlebars = require('handlebars'),
asyncHelpers = require('handlebars-async-helpers')
const hb = asyncHelpers(handlebars)
hb.registerHelper('sleep', async () => new Promise((resolve) => {
setTimeout(() => resolve('Done!'), 1000)
}))
const template = hb.compile('Mark when is completed: {{#sleep}}{{/sleep}}')
const result = await template()
console.log(result)
// 'Mark when is completed: Done!'