(injector: Injector)
| 29 | * @publicApi |
| 30 | */ |
| 31 | export function createPlatform(injector: Injector): PlatformRef { |
| 32 | if (getPlatform()) { |
| 33 | throw new RuntimeError( |
| 34 | RuntimeErrorCode.MULTIPLE_PLATFORMS, |
| 35 | ngDevMode && 'There can be only one platform. Destroy the previous one to create a new one.', |
| 36 | ); |
| 37 | } |
| 38 | |
| 39 | publishDefaultGlobalUtils(); |
| 40 | publishSignalConfiguration(); |
| 41 | if (typeof ngDevMode !== 'undefined' && ngDevMode) { |
| 42 | _unregisterAiTools = registerAiTools(); |
| 43 | } |
| 44 | |
| 45 | // During SSR, using this setting and using an injector from the global can cause the |
| 46 | // injector to be used for a different requjest due to concurrency. |
| 47 | _platformInjector = typeof ngServerMode === 'undefined' || !ngServerMode ? injector : null; |
| 48 | |
| 49 | const platform = injector.get(PlatformRef); |
| 50 | runPlatformInitializers(injector); |
| 51 | return platform; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Creates a factory for a platform. Can be used to provide or override `Providers` specific to |
no test coverage detected