npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

aviflow

v1.1.1

Published

A lightweight, dependency-free JavaScript utility to automate fetch requests using native HTML data-attributes.

Readme

AviFlow 🚀

A lightweight, zero-dependency JavaScript utility to automate network fetch requests natively using HTML data-* attributes.

AviFlow enables declarative AJAX interactions directly from your HTML elements via event delegation, working seamlessly on elements added dynamically to the page. It can be dropped directly into legacy setups as a standalone browser script or bundled into modern ES module applications.


✨ Features

  • Micro-sized & Dependency-free: Written in pure, modern vanilla JavaScript.
  • Event Delegation: Listens on the document body—automatically handles any elements added to the DOM dynamically via AJAX without re-binding.
  • Dual-Loading Support: Supports native ES Module import syntax and classic standalone <script> tags.
  • Flexible Configuration: Reads URLs, HTTP methods, target element injection, and payload bodies entirely from your element attributes.
  • Smart Fallbacks: Safely falls back to an anchor tag's native href if data-url isn't provided.

📦 Architecture & Installation

1. Standalone Drop-in (Traditional Script)

Download or reference dist/aviflow.min.js in your HTML page:

<script src="path/to/dist/aviflow.min.js"></script>
<script>
  document.addEventListener('DOMContentLoaded', () => {
    new AviFlow();
  });
</script>

2. Modern Application Setup (ES Module)

Import the library inside your JavaScript application bundle:

import AviFlow from './dist/aviflow.js';

const myFlow = new AviFlow();

🚀 HTML API Usage

Simply apply data-action="fetch" to any interactive HTML element.

Example 1: Simple GET Request (Content Injection)

Fetch data from an API and automatically inject the response text/HTML directly into another DOM container using data-target.

<button 
  data-action="fetch" 
  data-url="[https://jsonplaceholder.typicode.com/users/1](https://jsonplaceholder.typicode.com/users/1)" 
  data-target="#result-box">
  Load User Info
</button>

<div id="result-box">Profile data will render here...</div>

Example 2: Interactive POST Request with Payload

Use standard attributes to pass customized HTTP methods and structured JSON payloads.

<a href="#" 
   data-action="fetch" 
   data-url="/api/posts" 
   data-method="POST" 
   data-body='{"title": "Hello World", "body": "AviFlow is fast."}'
   data-target="#response-log">
   Submit Post
</a>

<div id="response-log"></div>

🛠️ Customization & Callbacks

You can pass an options object during initialization to handle global hooks or catch internal custom events.

Hook Interception Configuration

const flow = new AviFlow({
  selector: '[data-action="fetch"]', // Customize the selector if needed
  onSuccess: (data, element) => {
    console.log('Successfully fetched:', data);
  },
  onError: (error, element) => {
    console.error('Fetch operation failed:', error);
  }
});

Global Custom DOM Events

AviFlow inherently bubbles up custom events. You can attach event listeners to higher-level elements or document.body directly:

document.body.addEventListener('aviflow:success', (event) => {
  console.log('Global success event received payload:', event.detail);
});

document.body.addEventListener('aviflow:error', (event) => {
  console.error('Global error caught:', event.detail);
});

🏗️ Developer Setup

If you wish to modify or build AviFlow from source, clone this repository and follow these commands:

1. Install Build Tooling (esbuild):

npm install

2. Compile Production Distributions:

Builds both dist/aviflow.js (ES Module) and dist/aviflow.min.js (minified fallback) via your package configuration:

npm run build

3. Development Watch Mode:

npm run watch

📝 License

This project is open-sourced software licensed under the Apache 2.0 License.