Type alias HttpFetch

HttpFetch: ((this: void, input: RequestInfo, init?: RequestInit) => OnEvent<[Response]>)

Type declaration

    • (this: void, input: RequestInfo, init?: RequestInit): OnEvent<[Response]>
    • HTTP fetch function signature.

      This is a function that wraps browser's fetch() function and provides additional functionality. E.g. request interception.

      This function returns an OnEvent sender instead of a Promise. This allows to report multiple responses. E.g. when the resource refresh requested and delivered. The request is sent whenever a receiver is registered in this sender. When the fetch completes the response supply is cut off, and callbacks registered with its whenOff() method are notified. When fetch fails for whatever reason, this reason is passed to these callbacks. The fetch can be aborted by cutting off the response supply. I.e. by calling its off() method.

      An instance of HttpFetch is available from bootstrap context.

      Returns

      An OnEvent sender of responses.

      Parameters

      • this: void
      • input: RequestInfo

        The resource to fetch. This can either an URL string, or a Request object.

      • Optional init: RequestInit

        Custom settings to apply to the request.

      Returns OnEvent<[Response]>

Generated using TypeDoc