-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
68 lines (61 loc) · 1.89 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import {Next} from "koa";
declare namespace KoaWebC {
/**
* The WebC - Koa middleware installer to add a render() function in your
* Koa app.
*
* @param options {@type {KoaWebCOptions}} to set up this middleware.
*
* @returns the call to {@type {Next}} so installed middleware participates in
* the Koa call stack.
*/
function KoaWebC(options: KoaWebCOptions): Next;
/**
* Options for the middleware installer
*/
type KoaWebCOptions = {
/**
* folder containing the views relative to application execution point
*/
viewPath: string,
/**
* glob or globs to pass to WebC defineComponents function
*/
defineComponents?: string | string[]
/**
* the {@type {WebC}} bundleMode value
*/
bundle: boolean,
/**
* the @type {WebC} data option to pass directly to page.compile call
*/
data: any
}
/**
* the render function is called whenever someone calls
* ctx.render() inside a {@type {Koa}} use or a router method or something.
*
* @param viewName name of the webc template to be rendered
*
* @param extra extra param options {@type {KoaWebCExtraOptions}} to merge
* with {@type {KoaWebCOptions}} when rendering a template
*
* @returns promise so the next middleware can be called
*/
function RenderKoaWebC(viewName: string, extra: KoaWebCExtraOptions): Promise<void>
type KoaWebCExtraOptions = {
/**
* the {@type {WebC}} bundleMode value
*/
bundle: boolean,
/**
* glob or globs to pass to WebC defineComponents function
*/
defineComponents?: string | string[]
/**
* the @type {WebC} data option to pass directly to page.compile call
*/
data: any
}
}
export = KoaWebC