code: function (event) {
                  // Do nothing if the request has been cancelled.
                  if (cancelled) {
                      return;
                  }
                  // Cleanup the page.
                  cleanup();
                  // Check whether the response callback has run.
                  if (!finished) {
                      // It hasn't, something went wrong with the request. Return an error via
                      // the Observable error path. All JSONP errors have status 0.
                      observer.error(new HttpErrorResponse({
                          url: url,
                          status: 0,
                          statusText: 'JSONP Error',
                          error: new Error(JSONP_ERR_NO_CALLBACK),
                      }));
                      return;
                  }
                  // Success. body either contains the response body or null if none was
                  // returned.
                  observer.next(new HttpResponse({
                      body: body,
                      status: 200,
                      statusText: 'OK', url: url,
                  }));
                  // Complete the stream, the response is over.
                  observer.complete();
              }
docs: onLoad() is the success callback which runs after the response callback if the JSONP script loads successfully. The event itself is unimportant. If something went wrong, onLoad() may run without the response callback having been invoked.