Pebble App Framework: Phone API
    Preparing search index...

    Function requestJson

    • Fetches a URL past any cache and parses the reply as JSON.

      onJson hears every reply, with the request error beside the parsed body. The body is null when there was none or it did not parse. That way a provider can still read a bodyless 401 or 429 off the error, and each feature picks its own status for a reply it cannot read.

      Type Parameters

      • T = unknown

      Parameters

      • url: string

        The URL to fetch. A cache busting param is added before the request goes out.

      • get: RequestFn

        The HTTP GET to use, normally request.

      • onJson: (err: string | null, json: T | null) => void

        Called once with the request error, or null, and the parsed body, or null.

      Returns void