mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Update swig-email-templates
This commit is contained in:
+11
-2
@@ -1,6 +1,7 @@
|
||||
// Type definitions for swig-email-templates
|
||||
// Project: https://github.com/andrewrk/swig-email-templates
|
||||
// Definitions by: Adam Babcock <https://github.com/mrhen>
|
||||
// Satana Charuwichitratana <https://github.com/micksatana>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="swig" />
|
||||
@@ -13,8 +14,16 @@ interface SwigRender<T> {
|
||||
|
||||
interface SwigEmailTemplatesOptions extends swig.SwigOptions {
|
||||
root?: string;
|
||||
juice?: any;
|
||||
}
|
||||
|
||||
declare function init<T>(options: SwigEmailTemplatesOptions, cb: (err: any, render: SwigRender<T>) => any): any;
|
||||
export = init;
|
||||
declare class EmailTemplates {
|
||||
constructor(options?: SwigEmailTemplatesOptions);
|
||||
|
||||
generateText(templatePath: string, context: any, html: string, cb: Function): void;
|
||||
generateSubject(templatePath: string, context: any, cb: Function): void;
|
||||
rewriteUrls($: Function, rewrite: Function): void;
|
||||
render(templatePath: string, context: any, cb: Function): void;
|
||||
}
|
||||
|
||||
export = EmailTemplates;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import EmailTemplates = require('swig-email-templates');
|
||||
|
||||
import emailTemplates = require('swig-email-templates');
|
||||
let templates = new EmailTemplates(),
|
||||
withOptions = new EmailTemplates({ root: '' });
|
||||
|
||||
var options = {
|
||||
root: "root"
|
||||
};
|
||||
templates.generateText('templatePath', {}, 'html', function () { });
|
||||
templates.generateSubject('templatePath', {}, function () { });
|
||||
templates.rewriteUrls(function () {}, function () {});
|
||||
templates.render('templatePath', {}, function () { });
|
||||
|
||||
withOptions.generateText('templatePath', {}, 'html', function () { });
|
||||
withOptions.generateSubject('templatePath', {}, function () { });
|
||||
withOptions.rewriteUrls(function () {}, function () {});
|
||||
withOptions.render('templatePath', {}, function () { });
|
||||
|
||||
emailTemplates(options, function(err, render) {
|
||||
var context = {
|
||||
meatballCount: 9001,
|
||||
};
|
||||
render('meatball-sandwich.html', context, function(err, html, text) {
|
||||
// send html/text email
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user