An open API service indexing awesome lists of open source software.

https://github.com/faustienf/request-stripe

🌈 A progress bar of your request
https://github.com/faustienf/request-stripe

loading loading-indicator progress progress-bar request-loading request-process stripe typescript vanilla-javascript youtube-like-loading-bar

Last synced: 9 months ago
JSON representation

🌈 A progress bar of your request

Awesome Lists containing this project

README

          



[![npm-version](https://img.shields.io/npm/v/request-stripe.svg)](https://npmjs.org/package/request-stripe)

# request-stripe

🌈 The tiny library for rendering a progress bar on top your screen.

## Features

- 📦 Zero dependencies
- 🕯 Framework agnostic, using vanila API
- 🗜 Less [3 KB](https://bundlephobia.com/package/request-stripe)
- 🔨 Tiny API
- ⚙️ Customize render and styles
- 🧲 Autocombine requests

## Getting Started

```sh
npm install request-stripe
```

```js
import { requestStripe } from 'request-stripe';

fetch().finally(requestStripe());
// or
const done = requestStripe();
fetch().finally(() => {
done();
});
```

## Customization

### Styles via `.request-stripe-custom`

```css
.request-stripe-custom {
color: #e11d48;
animation-name: custom-process, custom-finish;
animation-...
}

.request-stripe-custom[data-state='process'] {
animation-play-state: running, paused;
}

.request-stripe-custom[data-state='finish'] {
animation-play-state: paused, running;
}

@keyframes custom-process {
...
}

@keyframes custom-finish {
...
}
```

### Render

```ts
import { Render, requestStripe } from 'request-stripe';

// Write a render function
const customRender: Render = () => {
const customElement = document.createElement('div');
document.body.appendChild(customElement);

return () => {
document.body.removeChild(stripeElement);
};
};

// Pass the function
const done = requestStripe(customRender);
fetch().finally(done);
```