* Destroy the application in a macrotask, this allows pending promises to be settled and errors * to be surfaced to the users.
(platformRef: PlatformRef)
| 267 | * to be surfaced to the users. |
| 268 | */ |
| 269 | function asyncDestroyPlatform(platformRef: PlatformRef): Promise<void> { |
| 270 | if (platformRef.destroyed) { |
| 271 | return Promise.resolve(); |
| 272 | } |
| 273 | |
| 274 | return new Promise<void>((resolve, reject) => { |
| 275 | setTimeout(() => { |
| 276 | try { |
| 277 | if (!platformRef.destroyed) { |
| 278 | platformRef.destroy(); |
| 279 | } |
| 280 | resolve(); |
| 281 | } catch (error) { |
| 282 | reject(error); |
| 283 | } |
| 284 | }, 0); |
| 285 | }); |
| 286 | } |
| 287 | |
| 288 | /** |
| 289 | * Specifies the value that should be used if no server context value has been provided. |
no test coverage detected