Skip to main content
Home
It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
76%
Published
2 years ago (1.0.0)
class Fetchling

The Fetchling class provides a wrapper around the browser fetch() API, storing a reusable request object, and exposing helper functions to access nested sub-resources of the base URL.

Constructors

new
Fetchling(
url: string | URL,
init?: FRequestInit,
)

Class constructor for a Fetchling instance.

Properties

Methods

Execute a "DELETE" request on the given Fetchling instance, with optional configuration.

private
doFetch(
url?:
string
| URL
| null
,
init?: FRequestInit,
): Promise<FResponse>

Execute a fetch() with the given request and configuration on the Fetchling class.

Execute a fetch() with optional config params. Example:

const api = f("http://foo.com/endpoint", { json: true }); const { data } = await api.fetch({ params: new URLSearchParams({ order_by: "date" }); });

Execute a fetch() with the given request and configuration on the Fetchling class.

Execute a "GET" request on the given Fetchling instance, with optional configuration.

private
getUrl(): string | URL

Internal helper to get the originally configured URL argument for the fetch request.

Execute a "HEAD" request on the given Fetchling instance, with optional configuration.

Execute a "PATCH" request on the given Fetchling instance, with optional configuration.

Execute a "POST" request on the given Fetchling instance, with optional configuration.

Execute a "PUT" request on the given Fetchling instance, with optional configuration.

Static Methods

create(
url: string | URL,
init?: FRequestInit | undefined,
): Fetchling

Factory method to create a new hybrid type Fetchling instance

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@kwhinnery/fetchling

Import symbol

import { Fetchling } from "@kwhinnery/fetchling";
or

Import directly with a jsr specifier

import { Fetchling } from "jsr:@kwhinnery/fetchling";

Add Package

pnpm i jsr:@kwhinnery/fetchling
or (using pnpm 10.8 or older)
pnpm dlx jsr add @kwhinnery/fetchling

Import symbol

import { Fetchling } from "@kwhinnery/fetchling";

Add Package

yarn add jsr:@kwhinnery/fetchling
or (using Yarn 4.8 or older)
yarn dlx jsr add @kwhinnery/fetchling

Import symbol

import { Fetchling } from "@kwhinnery/fetchling";

Add Package

vlt install jsr:@kwhinnery/fetchling

Import symbol

import { Fetchling } from "@kwhinnery/fetchling";

Add Package

npx jsr add @kwhinnery/fetchling

Import symbol

import { Fetchling } from "@kwhinnery/fetchling";

Add Package

bunx jsr add @kwhinnery/fetchling

Import symbol

import { Fetchling } from "@kwhinnery/fetchling";