UNPKG

2.59 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 { PrebootOptions } from '../common/preboot.interfaces';
9export declare const initFunctionName = "prebootInitFn";
10export declare const defaultOptions: PrebootOptions;
11/**
12 * Get the event recorder code based on all functions in event.recorder.ts
13 * and the getNodeKeyForPreboot function.
14 */
15export declare function getEventRecorderCode(): string;
16/**
17 * Used by the server side version of preboot. The main purpose is to get the
18 * inline code that can be inserted into the server view.
19 * Returns the definitions of the prebootInit function called in code returned by
20 * getInlineInvocation for each server node separately.
21 *
22 * @param customOptions PrebootRecordOptions that override the defaults
23 * @returns Generated inline preboot code with just functions definitions
24 * to be used separately
25 */
26export declare function getInlineDefinition(customOptions?: PrebootOptions): string;
27/**
28 * Used by the server side version of preboot. The main purpose is to get the
29 * inline code that can be inserted into the server view.
30 * Invokes the prebootInit function defined in getInlineDefinition with proper
31 * parameters. Each appRoot should get a separate inlined code from a separate
32 * call to getInlineInvocation but only one inlined code from getInlineDefinition.
33 *
34 * @returns Generated inline preboot code with just invocations of functions from
35 * getInlineDefinition
36 */
37export declare function getInlineInvocation(): string;
38/**
39 * Throw an error if issues with any options
40 * @param opts
41 */
42export declare function validateOptions(opts: PrebootOptions): void;
43/**
44 * Object.assign() is not fully supporting in TypeScript, so
45 * this is just a simple implementation of it
46 *
47 * @param target The target object
48 * @param optionSets Any number of addition objects that are added on top of the
49 * target
50 * @returns A new object that contains all the merged values
51 */
52export declare function assign(target: Object, ...optionSets: any[]): Object;
53/**
54 * Stringify an object and include functions. This is needed since we are
55 * letting users pass in options that include custom functions for things like
56 * the freeze handler or action when an event occurs
57 *
58 * @param obj This is the object you want to stringify that includes some
59 * functions
60 * @returns The stringified version of an object
61 */
62export declare function stringifyWithFunctions(obj: Object): string;