@ms-cloudpack/common-types-browser
Advanced tools
Comparing version 0.5.1 to 0.5.2
export {}; // Make this a module | ||
/** Client-side context object for a Cloudpack session, used for API requests and telemetry. */ | ||
export interface PageSessionContext { | ||
/** UUID for the current session */ | ||
sessionId: string; | ||
/** API server URL */ | ||
apiUrl: string; | ||
/** Session version used to trigger reloads */ | ||
currentSequence: number; | ||
/** Bundle server URL */ | ||
bundleServerUrl: string; | ||
/** Requested URL */ | ||
requestPath: string; | ||
} | ||
/** | ||
* Input for `window.__cloudpack.bootstrap` function defined by `app-server`'s `bootstrap.inline.ts`. | ||
* It's set by `app-server`'s `renderBootstrapRoute` function. | ||
*/ | ||
export interface BootstrapInput { | ||
/** Strings of inline JS scripts, to be added as script tag contents */ | ||
inlineScripts: string[]; | ||
/** URL for the Cloudpack overlay, to be added as a script tag */ | ||
overlayScript?: string; | ||
/** Import map to be added to the page */ | ||
importMap: { | ||
@@ -18,3 +31,5 @@ imports: Record<string, string>; | ||
}; | ||
/** Client-side context object for a Cloudpack session */ | ||
pageSessionContext: PageSessionContext; | ||
/** Additional entry module import paths, to be added as script tags */ | ||
entryScripts?: string[]; | ||
@@ -26,3 +41,5 @@ } | ||
__cloudpack?: { | ||
/** Get page load time for telemetry (defined in `getPageLoadTime.inline.ts`) */ | ||
getPageLoadTime?: () => Promise<number>; | ||
/** Get cache hit ratio for telemetry (defined in `getBrowserCacheRatio.inline.ts`) */ | ||
getBrowserCacheRatio?: () => { | ||
@@ -33,5 +50,12 @@ ratio: number; | ||
}; | ||
/** Set up a Cloudpack app in side-loading scenarios (defined in `bootstrap.inline.ts`) */ | ||
bootstrap?: (input: BootstrapInput) => void; | ||
/** Whether the bootstrap script has run (defined in `bootstrap.inline.ts`). */ | ||
hasBootstrapRun?: boolean; | ||
/** Client-side context object for a Cloudpack session (defined by the app server while rendering HTML routes) */ | ||
pageSessionContext?: PageSessionContext; | ||
}; | ||
/** Track uncaught errors (defined in `errorHandler.inline.ts` and read by the overlay) */ | ||
__pageErrors: { | ||
@@ -38,0 +62,0 @@ uncaughtErrors: ErrorEvent[]; |
{ | ||
"name": "@ms-cloudpack/common-types-browser", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "Types for Cloudpack browser globals.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
3716
59