diff --git a/example-embedded-app/package-lock.json b/example-embedded-app/package-lock.json index c8b82e4..50e4376 100644 --- a/example-embedded-app/package-lock.json +++ b/example-embedded-app/package-lock.json @@ -49,7 +49,7 @@ }, "..": { "name": "@prismatic-io/embedded", - "version": "2.5.2", + "version": "2.6.0", "license": "MIT", "dependencies": { "@prismatic-io/spectral": "^8.0.3", diff --git a/package-lock.json b/package-lock.json index da92375..4fa0d0a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@prismatic-io/embedded", - "version": "2.5.2", + "version": "2.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@prismatic-io/embedded", - "version": "2.5.2", + "version": "2.6.0", "license": "MIT", "dependencies": { "@prismatic-io/spectral": "^8.0.3", diff --git a/package.json b/package.json index 1ec758c..67ec850 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/prismatic-io/embedded.git" }, "license": "MIT", - "version": "2.5.2", + "version": "2.6.0", "main": "dist/index.js", "types": "dist/index.d.ts", "files": [ diff --git a/src/lib/init.ts b/src/lib/init.ts index fb22cb5..dc4a09e 100644 --- a/src/lib/init.ts +++ b/src/lib/init.ts @@ -18,7 +18,7 @@ export interface InitProps State, "screenConfiguration" | "theme" | "fontConfiguration" | "translation" >, - Partial> {} + Partial> {} export const EMBEDDED_DEFAULTS = { filters: { @@ -34,6 +34,7 @@ export const EMBEDDED_DEFAULTS = { marketplace: {}, initializing: {}, }, + skipPreload: false, theme: "LIGHT", fontConfiguration: undefined, translation: {}, @@ -62,6 +63,24 @@ export const init = (optionsBase?: InitProps) => { return; } + /** + * This establishes a connection to the prismatic url and preloads + * assets (css, js, fonts, etc.) into browser cache. Subsequent + * calls, use existing connections and cached assets. + */ + if (!options.skipPreload) { + document.body.insertAdjacentHTML( + "beforeend", + `