mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 18:43:21 +08:00
* Add .d.ts for co-views * Update co-view.d.ts Fix bug, the render function should return any * Update and rename co-view.d.ts to co-views.d.ts Fix naming conventions * Update and rename co-view-tests.ts to co-views-tests.ts Fix naming conventions * Update co-views-tests.ts Fix reference path
27 lines
533 B
TypeScript
27 lines
533 B
TypeScript
/// <reference path="../node/node.d.ts" />
|
|
/// <reference path="co-views.d.ts" />
|
|
|
|
import views = require('co-views');
|
|
|
|
const render = views('views', {
|
|
map: {
|
|
html: 'swig'
|
|
},
|
|
default: 'jade'
|
|
});
|
|
|
|
const fileName = 'xxx'; // template file name
|
|
const locals = {}; // template locals data
|
|
|
|
async function test() {
|
|
const html = await render(fileName, locals);
|
|
console.log(html);
|
|
}
|
|
|
|
// or use generator
|
|
|
|
// function* test() {
|
|
// const html = yield render(fileName, locals);
|
|
// console.log(html);
|
|
// }
|