How to use the @firebase/webchannel-wrapper.XhrIo function in @firebase/webchannel-wrapper

To help you get started, we’ve selected a few @firebase/webchannel-wrapper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github firebase / firebase-js-sdk / packages / firestore / src / platform_browser / webchannel_connection.ts View on Github external
return new Promise((resolve: Resolver, reject: Rejecter) => {
      const xhr = new XhrIo();
      xhr.listenOnce(EventType.COMPLETE, () => {
        try {
          switch (xhr.getLastErrorCode()) {
            case ErrorCode.NO_ERROR:
              const json = xhr.getResponseJson() as Resp;
              log.debug(LOG_TAG, 'XHR received:', JSON.stringify(json));
              resolve(json);
              break;
            case ErrorCode.TIMEOUT:
              log.debug(LOG_TAG, 'RPC "' + rpcName + '" timed out');
              reject(
                new FirestoreError(Code.DEADLINE_EXCEEDED, 'Request time out')
              );
              break;
            case ErrorCode.HTTP_ERROR:
              const status = xhr.getStatus();

@firebase/webchannel-wrapper

A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application

Apache-2.0
Latest version published 5 days ago

Package Health Score

95 / 100
Full package analysis

Similar packages