(requiredToken: any)
| 115 | * @publicApi |
| 116 | */ |
| 117 | export function assertPlatform(requiredToken: any): PlatformRef { |
| 118 | const platform = getPlatform(); |
| 119 | if (!platform) { |
| 120 | throw new RuntimeError(RuntimeErrorCode.PLATFORM_NOT_FOUND, ngDevMode && 'No platform exists!'); |
| 121 | } |
| 122 | |
| 123 | if ( |
| 124 | (typeof ngDevMode === 'undefined' || ngDevMode) && |
| 125 | !platform.injector.get(requiredToken, null) |
| 126 | ) { |
| 127 | throw new RuntimeError( |
| 128 | RuntimeErrorCode.MULTIPLE_PLATFORMS, |
| 129 | 'A platform with a different configuration has been created. Please destroy it first.', |
| 130 | ); |
| 131 | } |
| 132 | |
| 133 | return platform; |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Returns the current platform in the browser environment. In the server environment, |
no test coverage detected
searching dependent graphs…