UNPKG

2.97 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { EventSelector, PrebootOptions, PrebootAppData, PrebootData, PrebootWindow, ServerClientRoot, PrebootSelection } from '../common/preboot.interfaces';
9/**
10 * Called right away to initialize preboot
11 *
12 * @param opts All the preboot options
13 * @param win
14 */
15export declare function initAll(opts: PrebootOptions, win?: PrebootWindow): () => void;
16/**
17 * Start up preboot by going through each app and assigning the appropriate
18 * handlers. Normally this wouldn't be called directly, but we have set it up so
19 * that it can for older versions of Universal.
20 *
21 * @param prebootData Global preboot data object that contains options and will
22 * have events
23 * @param win Optional param to pass in mock window for testing purposes
24 */
25export declare function start(prebootData: PrebootData, win?: PrebootWindow): void;
26/**
27 * Create an overlay div and add it to the DOM so it can be used
28 * if a freeze event occurs
29 *
30 * @param _document The global document object (passed in for testing purposes)
31 * @returns Element The overlay node is returned
32 */
33export declare function createOverlay(_document: Document): HTMLElement | undefined;
34/**
35 * Get references to the current app root node based on input options. Users can
36 * initialize preboot either by specifying appRoot which is just one or more
37 * selectors for apps. This section option is useful for people that are doing their own
38 * buffering (i.e. they have their own client and server view)
39 *
40 * @param _document The global document object used to attach the overlay
41 * @param opts Options passed in by the user to init()
42 * @param serverNode The server node serving as application root
43 * @returns ServerClientRoot An array of root info for the current app
44 */
45export declare function getAppRoot(_document: Document, opts: PrebootOptions, serverNode: HTMLElement): ServerClientRoot;
46/**
47 * Under given server root, for given selector, record events
48 *
49 * @param _document
50 * @param prebootData
51 * @param appData
52 * @param eventSelector
53 */
54export declare function handleEvents(_document: Document, prebootData: PrebootData, appData: PrebootAppData, eventSelector: EventSelector): void;
55/**
56 * Create handler for events that we will record
57 */
58export declare function createListenHandler(_document: Document, prebootData: PrebootData, eventSelector: EventSelector, appData: PrebootAppData): EventListener;
59/**
60 * Get the selection data that is later used to set the cursor after client view
61 * is active
62 */
63export declare function getSelection(node: HTMLInputElement): PrebootSelection;
64/**
65 * Create buffer for a given node
66 *
67 * @param root All the data related to a particular app
68 * @returns Returns the root client node.
69 */
70export declare function createBuffer(root: ServerClientRoot): HTMLElement;