MCPcopy Create free account
hub / github.com/angular/angular / createPlatform

Function createPlatform

packages/core/src/platform/platform.ts:31–52  ·  view source on GitHub ↗
(injector: Injector)

Source from the content-addressed store, hash-verified

29 * @publicApi
30 */
31export 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

Callers 1

createPlatformFactoryFunction · 0.85

Calls 6

registerAiToolsFunction · 0.90
getPlatformFunction · 0.85
runPlatformInitializersFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected