MCPcopy
hub / github.com/angular/angular / createPlatform

Function createPlatform

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

Source from the content-addressed store, hash-verified

36 * @publicApi
37 */
38export function createPlatform(injector: Injector): PlatformRef {
39 if (getPlatform()) {
40 throw new RuntimeError(
41 RuntimeErrorCode.MULTIPLE_PLATFORMS,
42 ngDevMode && 'There can be only one platform. Destroy the previous one to create a new one.',
43 );
44 }
45
46 publishDefaultGlobalUtils();
47 publishSignalConfiguration();
48 if (typeof ngDevMode !== 'undefined' && ngDevMode) {
49 _unregisterAiTools = registerAiTools();
50 }
51
52 // During SSR, using this setting and using an injector from the global can cause the
53 // injector to be used for a different requjest due to concurrency.
54 _platformInjector = typeof ngServerMode === 'undefined' || !ngServerMode ? injector : null;
55
56 const platform = injector.get(PlatformRef);
57 runPlatformInitializers(injector);
58 return platform;
59}
60
61/**
62 * 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…