
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
request-state-wrapper
Advanced tools
A small, less than 1kb gzipped, utility wrapper for Asynchronous JavaScript events.
It allows you to easily handle fetching, stalled and finished states.

The way we handle loading states in front end applications can be incredibly reptetive and imperative.
We also design loading states that aren't always the optimal user experience for all users. This means users with fast AND slow connections.
Request State Wrapper aims to solve the following problems.
npm install --save request-state-wrapper
import { createRequest } from 'request-state-wrapper';
const yourAsyncFunction = () =>
fetch('https://api.github.com/repos/nodejs/node').then(response => response.json());
// Create your request with request-state-wrapper
const request = createRequest({
request: yourAsyncFunction,
stalledDelay: 1000,
onStalled: () => { /* handle stalled state */ },
});
// Run it!
request()
.then(response => { /* handle request response */ })
.catch(error => { /* handle request error */ });
For more detailed implementation recipies see:
createRequest takes a single object argument.
const demoRequest = createRequest({
request,
stalledDelay,
onStateChange,
onFetching,
onStalled,
onFinished,
})
Required
request - Function that returns a promise or Array of functions that return promisesOptional
stalledDelay - Time, in milliseconds, it takes for the request to be considered stalled (defaults to 1000)onStateChange - Handler function that is called whenever the request state changesonFetching - Handler function that is called whenever the request starts fetchingonStalled - Handler function that is called whenever the request state becomes stalledonFinished - Handler function that is called whenever the request state finishescreateRequest returns a function that invokes the request. It takes a single argument, an object of options all of which are optional.
demoRequest({
onStateChange,
onFetching,
onStalled,
onFinished,
})
onStateChange - Handler function that is called whenever the request state changesonFetching - Handler function that is called whenever the request starts fetchingonStalled - Handler function that is called whenever the request state becomes stalledonFinished - Handler function that is called whenever the request state finishesImportant:
onFetching, onStalled, onFinished take precedence over onStateChangeFAQs
A tiny package for managing the state of asynchronous requests.
The npm package request-state-wrapper receives a total of 2 weekly downloads. As such, request-state-wrapper popularity was classified as not popular.
We found that request-state-wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.