* Loads the Prism module once and caches both the in-flight promise and the * resolved module for reuse. * * @returns A promise resolving to the Prism highlighting utilities.
()
| 44 | * @returns A promise resolving to the Prism highlighting utilities. |
| 45 | */ |
| 46 | function loadPrism(): Promise<PrismModule> { |
| 47 | if (!prismModulePromise) { |
| 48 | prismModulePromise = import('./prism').then((mod) => { |
| 49 | resolvedPrism = mod |
| 50 | return mod |
| 51 | }) |
| 52 | } |
| 53 | return prismModulePromise |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Subscribes a client component to the lazily-loaded Prism module. |