/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {DOCUMENT} from '@angular/common'; import { EnvironmentInjector, Inject, inject, Injectable, runInInjectionContext, } from '@angular/core'; import {Observable, Observer} from 'rxjs'; import {HttpBackend, HttpHandler} from './backend'; import {HttpHandlerFn} from './interceptor'; import {HttpRequest} from './request'; import { HTTP_STATUS_CODE_OK, HttpErrorResponse, HttpEvent, HttpEventType, HttpResponse, } from './response'; // Every request made through JSONP needs a callback name that's unique across the // whole page. Each request is assigned an id and the callback name is constructed // from that. The next id to be assigned is tracked in a global variable here that // is shared among all applications on the page. let nextRequestId: number = 0; /** * When a pending