UNPKG

1.91 kBTypeScriptView Raw
1import { View, Template, KeyedTemplate } from '../core/view';
2import { Page } from '../page';
3import { NavigationEntry } from '../frame';
4
5export interface LoadOptions {
6 path: string;
7 name: string;
8 attributes?: any;
9 exports?: any;
10 page?: Page;
11}
12
13/**
14 * @deprecated Use Builder.createViewFromEntry() instead.
15 */
16export function createViewFromEntry(entry: NavigationEntry): View;
17
18/**
19 * @deprecated Use Builder.parse() instead.
20 */
21export function parse(value: string | Template, exports?: any): View;
22
23/**
24 * @deprecated Use Builder.parseMultipleTemplates() instead.
25 */
26export function parseMultipleTemplates(value: string, exports?: any): Array<KeyedTemplate>;
27
28/**
29 * @deprecated Use Builder.load() instead.
30 */
31export function load(fileName: string, exports?: any): View;
32
33/**
34 * @deprecated Use Builder.load() instead.
35 */
36export function load(options: LoadOptions): View;
37
38export class Builder {
39 /**
40 * UI plugin developers can add to these to define their own custom types if needed
41 */
42 static knownTemplates: Set<string>;
43 static knownMultiTemplates: Set<string>;
44 static knownCollections: Set<string>;
45
46 /**
47 * Creates view from navigation entry
48 * @param entry NavigationEntry
49 */
50 static createViewFromEntry(entry: NavigationEntry): View;
51
52 static parse(value: string | Template, exports?: any): View;
53
54 /**
55 * Creates an array of KeyedTemplates from string
56 * @param value The xml of the template to be parsed
57 * @param exports Current context of the template
58 */
59 static parseMultipleTemplates(value: string, exports?: any): Array<KeyedTemplate>;
60
61 /**
62 * Loads component from module with context
63 * @param moduleName the module name
64 * @param exports the context of the component to be loaded
65 */
66 static load(moduleName: string, exports?: any): View;
67
68 /**
69 * Loads component from options
70 * @param options Load options
71 */
72 static load(options: LoadOptions): View;
73}