web-serial-rxjs API Documentation
    Preparing search index...

    Function checkBrowserSupport

    • Check if the browser supports the Web Serial API, throwing an error if not supported.

      This function performs a feature detection check and throws a SerialError with code SerialErrorCode.BROWSER_NOT_SUPPORTED if the Web Serial API is not available. The error message includes the detected browser type for better user feedback.

      This is the recommended way to check browser support before using serial port functionality, as it provides clear error messages.

      Returns void

      SerialError with code SerialErrorCode.BROWSER_NOT_SUPPORTED if the browser doesn't support the Web Serial API

      try {
      checkBrowserSupport();
      // Safe to use serial port functionality
      const client = createSerialClient();
      } catch (error) {
      if (error instanceof SerialError && error.code === SerialErrorCode.BROWSER_NOT_SUPPORTED) {
      console.error(error.message);
      // Show user-friendly message: "Please use a Chromium-based browser..."
      }
      }