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