@yornaath/batshit
Advanced tools
Comparing version 0.2.11 to 0.3.0
@@ -22,3 +22,3 @@ import { deferred } from './deferred.esm.js'; | ||
let latest = null; | ||
devtools?.create({ seq, config }); | ||
devtools?.create({ seq }); | ||
const fetch = (query) => { | ||
@@ -25,0 +25,0 @@ if (!start) |
@@ -24,3 +24,3 @@ 'use strict'; | ||
let latest = null; | ||
devtools?.create({ seq, config }); | ||
devtools?.create({ seq }); | ||
const fetch = (query) => { | ||
@@ -27,0 +27,0 @@ if (!start) |
{ | ||
"name": "@yornaath/batshit", | ||
"version": "0.2.11", | ||
"version": "0.3.0", | ||
"description": "A batch manager that will deduplicate and batch requests for a certain data type made within a window.", | ||
@@ -5,0 +5,0 @@ "author": { |
# @yornaath/batshit [![CI](https://github.com/yornaath/batshit/actions/workflows/ci.yml/badge.svg)](https://github.com/yornaath/batshit/actions/workflows/ci.yml) | ||
A batch manager that will deduplicate and batch requests for a certain data type made within a window. | ||
A batch manager that will deduplicate and batch requests for a given data type made within a window of time (or other custom scheduling). Useful to batch requests made from multiple react components that uses react-query or do batch processing of accumulated tasks. | ||
### Codesandbox example | ||
Here is a codesanbox example using react, typescript, vite and the zeitgeist prediction-markets indexer api. | ||
It fetches markets up front and then batches all liquidity pool fetches made from the individual components into one request. | ||
[Codesandbox](https://codesandbox.io/s/yornaath-batshit-example-8f8q3w?file=/src/App.tsx) | ||
## Quickstart | ||
@@ -6,0 +12,0 @@ |
@@ -0,3 +1,3 @@ | ||
import type { DevtoolsListener } from "@yornaath/batshit-devtools"; | ||
import { deferred } from "./deferred"; | ||
/** | ||
@@ -84,3 +84,4 @@ * Batcher. | ||
const devtools = globalThis.__BATSHIT_DEVTOOLS__?.for(name); | ||
const devtools: DevtoolsListener<any, any> | undefined = | ||
globalThis.__BATSHIT_DEVTOOLS__?.for(name); | ||
@@ -94,3 +95,3 @@ let seq = 0; | ||
devtools?.create({ seq, config }); | ||
devtools?.create({ seq }); | ||
@@ -97,0 +98,0 @@ const fetch = (query: Q): Promise<R> => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
129
51681
20
654