trifid-core
Version:
Trifid Core
37 lines • 1.4 kB
TypeScript
export default templateEngine;
/**
* Register a new helper.
* - name: Name of the helper.
* - fn: Helper function.
*/
export type RegisterHelperFunction = (name: string, fn: import("handlebars").HelperDelegate) => void;
/**
* Render a view.
*/
export type RenderFunction = (request: import("fastify").FastifyRequest & {
session: Map<string, any>;
}, templatePath: string, context: Record<string, any>, options: Record<string, any>) => Promise<string>;
/**
* Register a new helper.
* - name: Name of the helper.
* - fn: Helper function.
*
* @typedef {(name: string, fn: import('handlebars').HelperDelegate) => void} RegisterHelperFunction
*/
/**
* Render a view.
*
* @typedef {(request: import('fastify').FastifyRequest & { session: Map<string, any> }, templatePath: string, context: Record<string, any>, options: Record<string, any>) => Promise<string>} RenderFunction
*/
/**
* Create a new template engine instance.
*
* @param {Object} defaultOptions Default optioons for the template engine.
* @param {Map<string, any>} locals Trifid locals.
* @returns {Promise<{ render: RenderFunction, registerHelper: RegisterHelperFunction }>} Template engine instance.
*/
declare function templateEngine(defaultOptions: any, locals: Map<string, any>): Promise<{
render: RenderFunction;
registerHelper: RegisterHelperFunction;
}>;
//# sourceMappingURL=templateEngine.d.ts.map