nanoeffects 0.24.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.d.ts +2 -2
- package/dist/dev.d.ts +1 -1
- package/dist/effects.d.ts +2 -2
- package/dist/effects.js +1 -1
- package/dist/{module-ChMx7hHT.d.ts → module-B5V47MZ0.d.ts} +1 -1
- package/dist/notrace/actions.d.ts +1 -1
- package/dist/notrace/effects.d.ts +2 -2
- package/dist/notrace/effects.js +1 -1
- package/dist/notrace/{plugin-jkWtYPT7.d.ts → plugin-ks-oNq5n.d.ts} +14 -9
- package/dist/{plugin-CGIdsEGF.d.ts → plugin-B6UQyoVd.d.ts} +14 -9
- package/dist/scope.d.ts +1 -1
- package/dist/{types-B0DMvfsU.d.ts → types-DWjyeii7.d.ts} +1 -1
- package/docs/effects.md +23 -0
- package/llms-full.txt +23 -0
- package/package.json +2 -2
package/dist/actions.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { H as PayloadOf, T as EventKey, W as Task, c as WithScope, h as Bus, n as Free, o as Scope, r as FreeActionCreator, t as ActionCreator, z as EventMap } from "./action-creator-Bpa8BUS9.js";
|
|
2
|
-
import { r as Scoped, t as FieldsOfScope } from "./types-
|
|
3
|
-
import { a as createModule, c as CarryingCalls, d as commandsPlugin, f as createCommand, l as MadeCommand, n as ModuleApi, o as modulePlugin, r as ModuleContext, s as Binding, t as Module, u as bindHandler } from "./module-
|
|
2
|
+
import { r as Scoped, t as FieldsOfScope } from "./types-DWjyeii7.js";
|
|
3
|
+
import { a as createModule, c as CarryingCalls, d as commandsPlugin, f as createCommand, l as MadeCommand, n as ModuleApi, o as modulePlugin, r as ModuleContext, s as Binding, t as Module, u as bindHandler } from "./module-B5V47MZ0.js";
|
|
4
4
|
import { t as OriginOptions } from "./origin-key-CxK0SkeG.js";
|
|
5
5
|
//#region src/actions/action.d.ts
|
|
6
6
|
type ScopedCreator<P, T extends string, F> = [P] extends [Free] ? FreeActionCreator<T, F> & WithScope<F> : ActionCreator<P, T, PayloadOf<P>, F> & WithScope<F>;
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { J as UnsubscribeCallback, h as Bus, z as EventMap } from "./action-creator-Bpa8BUS9.js";
|
|
2
|
-
import { i as WithApp, n as ModuleApi } from "./module-
|
|
2
|
+
import { i as WithApp, n as ModuleApi } from "./module-B5V47MZ0.js";
|
|
3
3
|
//#region src/dev/types.d.ts
|
|
4
4
|
/** The parts of what `modulePlugin` returned that the diagnostics report. */
|
|
5
5
|
type ReportedApp<E extends EventMap> = Pick<ModuleApi<E>, "mount" | "unmount" | "isMounted">;
|
package/dist/effects.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as WithSignal, W as Task, b as Context, u as Effect, z as EventMap } from "./action-creator-Bpa8BUS9.js";
|
|
2
|
-
import { a as RaceStarter, c as all, d as
|
|
2
|
+
import { a as RaceStarter, c as all, d as GroupOptions, f as Starter, i as take, l as ChildOf, m as delay, n as effectsPlugin, o as race, p as StarterOf, r as TakeOptions, s as allSettled, u as EffectContext } from "./plugin-B6UQyoVd.js";
|
|
3
3
|
//#region src/utils/onAbort.d.ts
|
|
4
4
|
export declare const onAbort: (ctx: {
|
|
5
5
|
signal?: AbortSignal | undefined;
|
|
@@ -187,4 +187,4 @@ export declare function timeout<C extends {
|
|
|
187
187
|
signal?: AbortSignal;
|
|
188
188
|
}, T>(ctx: C, ms: number, starter: Starter<T, ChildOf<C>>): Promise<T>;
|
|
189
189
|
//#endregion
|
|
190
|
-
export { type BackoffOptions, type CancellableExecutor, type CancellableHandle, type Effect, type EffectContext, type PollOptions, type RaceStarter, type RetryOptions, type StarterOf, type TakeOptions, all, allSettled, delay, effectsPlugin, race, take };
|
|
190
|
+
export { type BackoffOptions, type CancellableExecutor, type CancellableHandle, type Effect, type EffectContext, type GroupOptions, type PollOptions, type RaceStarter, type RetryOptions, type StarterOf, type TakeOptions, all, allSettled, delay, effectsPlugin, race, take };
|
package/dist/effects.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,r as n,t as r}from"./delay-18LJ8jSk.js";import{d as i,i as a,o,s,t as c,u as l}from"./context-UcmrAIhP.js";const u=(e,t)=>t?.signal?new Promise((n,r)=>{let i=l(t,r);e.then(n,r).finally(i)}):e,d=async(e,t,n,r)=>{t?.signal?.throwIfAborted();let{ctx:i,unlink:o}=a(t??{}),d=c(i,e);s(i,e,`start`),l(i,()=>d(`cancel`));try{let e=await u(n(i),t);return d(`done`),r?.(!1),e}catch(e){throw d(`error`,e),r?.(!0),e}finally{o()}},f=async(e,t)=>{let{ctx:n,unlink:r}=a(e);try{return await o(n,`run`,()=>t(n))}finally{r()}},p=e=>e,m=(e,t)=>n=>e(t,p(n)),h=e=>Array.isArray(e)?Array(e.length):{},g=(e,t)=>{let n=Object.entries(t).map(([t,n])=>{let r=a(e),i=()=>n(r.ctx);return{key:t,task:new Promise(e=>e(o(r.ctx,`run`,i))).finally(r.unlink),cancel:r.ctx.abort}});return{tasks:n.map(({key:e,task:t})=>[e,t]),cancelAll:()=>{for(let e of n)e.cancel()}}},_=(t,n)=>{if(t.length
|
|
1
|
+
import{i as e,n as t,r as n,t as r}from"./delay-18LJ8jSk.js";import{d as i,i as a,o,s,t as c,u as l}from"./context-UcmrAIhP.js";const u=(e,t)=>t?.signal?new Promise((n,r)=>{let i=l(t,r);e.then(n,r).finally(i)}):e,d=async(e,t,n,r)=>{t?.signal?.throwIfAborted();let{ctx:i,unlink:o}=a(t??{}),d=c(i,e);s(i,e,`start`),l(i,()=>d(`cancel`));try{let e=await u(n(i),t);return d(`done`),r?.(!1),e}catch(e){throw d(`error`,e),r?.(!0),e}finally{o()}},f=async(e,t)=>{let{ctx:n,unlink:r}=a(e);try{return await o(n,`run`,()=>t(n))}finally{r()}},p=e=>e,m=(e,t)=>n=>e(t,p(n)),h=e=>Array.isArray(e)?Array(e.length):{},g=(e,t)=>{let n=Object.entries(t).map(([t,n])=>{let r=a(e),i=()=>n(r.ctx);return{key:t,task:new Promise(e=>e(o(r.ctx,`run`,i))).finally(r.unlink),cancel:r.ctx.abort}});return{tasks:n.map(({key:e,task:t})=>[e,t]),cancelAll:()=>{for(let e of n)e.cancel()}}},_=e=>{let t=e?.concurrency??1/0;if(t!==1/0&&!(Number.isInteger(t)&&t>=1))throw RangeError(`concurrency must be a positive integer`);return t},v=(e,t,n,r)=>{let i=Object.entries(t),s=[],c=i.map(([e])=>[e,new Promise(e=>s.push(e))]),l=/* @__PURE__ */ new Set,u=0,d=0,f=!1,p=()=>{for(;!f&&!e.signal.aborted&&d<n&&u<i.length;){let t=u++,[,n]=i[t],c=a(e),m=()=>n(c.ctx),h=()=>{c.unlink(),l.delete(c.ctx.abort),d--};l.add(c.ctx.abort),d++;let g=new Promise(e=>e(o(c.ctx,`run`,m))).then(e=>(h(),p(),e),e=>{throw h(),f=r,p(),e});s[t]?.(g)}};return p(),{tasks:c,cancelAll:()=>{f=!0;for(let e of l)e()}}},y=(t,n)=>{if(t.length!==1)return n(...t);let[r]=t;if(e(Reflect.get(r,`signal`)))throw TypeError(`A group takes effects: call it as (effects), or as (ctx, effects); a context alone has none`);return e=>n(e,r)},b=(e,t,n,r,i,a)=>{let o=_(a),s=()=>{};return d(e,t,async t=>{let i=o===1/0?g(t,n):v(t,n,o,e===`all`);return s=i.cancelAll,r(i.tasks)},e=>{(e||i===`end`)&&s()})};function x(...e){return y(e,S)}const S=(e,t,n)=>b(`all`,e,t,async e=>{let n=await Promise.all(e.map(([,e])=>e)),r=h(t);for(let[t,[i]]of e.entries())r[i]=n[t];return r},`failure`,n),C=e=>e.then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}));function w(...e){return y(e,T)}const T=(e,t,n)=>b(`allSettled`,e,t,async e=>{let n=await Promise.all(e.map(([,e])=>C(e))),r=h(t);for(let[t,[i]]of e.entries())r[i]=n[t];return r},`failure`,n),E=e=>e>0?e:0,D=(e={})=>{let t=E(e.base??100),n=e.factor??2,r=E(e.max??1/0),i=e.jitter??!1;return e=>{let a=E(Math.min(r,t*n**(e-1)));return i?Math.random()*a||0:a}},O=(e,t)=>e.signal.aborted?Promise.reject(e.signal.reason):new Promise((n,r)=>{let a=[],o=`pending`,s=e=>{try{e()}catch(e){i(`cancel cleanup failed`,e)}},c=l(e,e=>{o=`cancelled`;for(let e of a.reverse())s(e);r(e)}),u=e=>(...t)=>{o===`pending`&&(o=`settled`,c(),a.length=0,e(...t))},d=e=>{o===`pending`?a.push(e):o===`cancelled`&&s(e)};try{t({resolve:u(n),reject:u(r),onCancel:d})}catch(e){u(r)(e)}}),k=Symbol(`nanoeffects.effects.effect`),A=e=>t=>{let n=t.addContext,r=Object.entries(e);return t.addContext=e=>{n?.(e);for(let[t,n]of r){let r=Reflect.get(e,t);if(r===void 0||r[k]===n){let r=(...t)=>n(e,...t);r[k]=n,Reflect.set(e,t,r)}}},t},j=()=>/* @__PURE__ */ TypeError(`A Task is called as (payload, ctx), or as (ctx) when a group starts it; the single argument is not a context`),M=t=>{if(e(t)&&`signal`in t)return t;throw j()},N=(e,t,n)=>t===void 0?n(M(e),void 0):n(t,e),P=(e,r,i,a)=>{if(e.signal.aborted)return Promise.resolve();let o=a.leading??!1,s=a.waitForFn??!1;return d(`poll`,e,e=>new Promise((a,c)=>{let u=0,d=null,p=()=>{d!==null&&(t(d),d=null)},m=e=>{try{d=n(h,typeof i==`function`?i(e):i)}catch(e){p(),c(e)}},h=()=>{d=null,s||m(u+1),g()},g=()=>{let t=u++;f(e,e=>r(e,t)).then(()=>{s&&!e.signal.aborted&&m(u)},e=>{p(),c(e)})};l(e,p),o?(g(),s||m(u)):m(0)})).catch(t=>{if(!e.signal.aborted)throw t})};function F(e,t,n,r={}){if(typeof e!=`object`){let r=t,i=n??{},a=(t,n)=>P(t,m(r,n),e,i);return(e,t)=>N(e,t,a)}let i=t;return P(e,(e,t)=>i(t),n,r)}function I(...e){return y(e,L)}const L=(e,t)=>{let n=h(t);return Object.keys(t).length===0?Promise.resolve(n):b(`race`,e,t,async e=>{let[t,r]=await Promise.race(e.map(([e,t])=>t.then(t=>[e,t])));return n[t]=r,n},`end`)},R=(e,t,n)=>typeof e==`function`?e(t,n):e,z=e=>({times:e.times??3,delay:e.delay??0,shouldRetry:e.shouldRetry??(()=>!0)}),B=(e,t,n)=>d(`retry`,e,async e=>{let{times:i,delay:a,shouldRetry:o}=z(n);for(let n=1;;n++)try{return await f(e,e=>t(e,n))}catch(t){if(e.signal.throwIfAborted(),!(n<i)||!o(t,n))throw t;let s=R(a,n,t);s>0&&await r(e,s)}});function V(e,t,n={}){if(typeof e==`function`){let n=e,r=t??{},i=(e,t)=>B(e,m(n,t),r);return(e,t)=>N(e,t,i)}let r=t;return B(e,(e,t)=>r(t),n)}const H=(e,t,n={})=>d(`take`,e,r=>new Promise((i,a)=>{let{predicate:o}=n,s=[],c=()=>{for(let e of s)e()},u=e=>{c(),a(e)},d=t;s.push(e.on(d,e=>{(!o||o(e))&&(c(),i(e))})),s.push(l(r,u)),s.push(l({signal:n.signal},u))}));function U(t,n,r){if(e(t))return H(t,n,r);let i=n;return e=>H(e,t,i)}const W=(e,r,i)=>d(`timeout`,e,async e=>{let s=a(e),c=n(()=>s.ctx.abort(new DOMException(`Timed out after ${r}ms`,`TimeoutError`)),r);try{return await u(Promise.resolve(o(s.ctx,`run`,()=>i(s.ctx))),s.ctx)}finally{t(c),s.unlink()}});function G(e,t,n){if(typeof e==`number`){let n=t,r=(t,r)=>W(t,e,m(n,r));return(e,t)=>N(e,t,r)}return W(e,t,n)}export{x as all,w as allSettled,D as backoff,O as cancellable,r as delay,A as effectsPlugin,l as onAbort,F as poll,I as race,V as retry,U as take,G as timeout};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { H as PayloadOf, J as UnsubscribeCallback, W as Task, _ as Command, b as Context, c as WithScope, h as Bus, o as Scope, v as CommandCall, y as Commands, z as EventMap } from "./action-creator-Bpa8BUS9.js";
|
|
2
|
-
import { n as ScopeSlots, r as Scoped, t as FieldsOfScope } from "./types-
|
|
2
|
+
import { n as ScopeSlots, r as Scoped, t as FieldsOfScope } from "./types-DWjyeii7.js";
|
|
3
3
|
//#region src/actions/command.d.ts
|
|
4
4
|
/** What `createCommand` returns: a command that also tells whether an action is of its type. */
|
|
5
5
|
type MadeCommand<P, R, T extends string> = Command<P, R> & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as EventKey, F as EventMap, L as PayloadOf, R as Task, _ as Commands, a as Scope, g as CommandCall, h as Command, n as Free, o as WithFields, p as Bus, r as FreeActionCreator, s as WithScope, t as ActionCreator, u as Effects, v as Context, z as UnsubscribeCallback } from "./action-creator-D2CotugT.js";
|
|
2
|
-
import { t as BoundOf } from "./plugin-
|
|
2
|
+
import { t as BoundOf } from "./plugin-ks-oNq5n.js";
|
|
3
3
|
import { t as OriginOptions } from "./origin-key-CxK0SkeG.js";
|
|
4
4
|
//#region src/scope/types.d.ts
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { F as EventMap, M as WithSignal, R as Task, l as Effect, v as Context } from "./action-creator-D2CotugT.js";
|
|
2
|
-
import { a as RaceStarter, c as all, d as
|
|
2
|
+
import { a as RaceStarter, c as all, d as GroupOptions, f as Starter, i as take, l as ChildOf, m as delay, n as effectsPlugin, o as race, p as StarterOf, r as TakeOptions, s as allSettled, u as EffectContext } from "./plugin-ks-oNq5n.js";
|
|
3
3
|
//#region src/utils/onAbort.d.ts
|
|
4
4
|
export declare const onAbort: (ctx: {
|
|
5
5
|
signal?: AbortSignal | undefined;
|
|
@@ -187,4 +187,4 @@ export declare function timeout<C extends {
|
|
|
187
187
|
signal?: AbortSignal;
|
|
188
188
|
}, T>(ctx: C, ms: number, starter: Starter<T, ChildOf<C>>): Promise<T>;
|
|
189
189
|
//#endregion
|
|
190
|
-
export { type BackoffOptions, type CancellableExecutor, type CancellableHandle, type Effect, type EffectContext, type PollOptions, type RaceStarter, type RetryOptions, type StarterOf, type TakeOptions, all, allSettled, delay, effectsPlugin, race, take };
|
|
190
|
+
export { type BackoffOptions, type CancellableExecutor, type CancellableHandle, type Effect, type EffectContext, type GroupOptions, type PollOptions, type RaceStarter, type RetryOptions, type StarterOf, type TakeOptions, all, allSettled, delay, effectsPlugin, race, take };
|
package/dist/notrace/effects.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,r as n,t as r}from"./delay-Besb3X1O.js";import{a as i,c as a,i as o,l as s,o as c,t as l}from"./context-_HWcdjZf.js";const u=(e,t)=>t?.signal?new Promise((n,r)=>{let i=a(t,r);e.then(n,r).finally(i)}):e,d=async(e,t,n,r)=>{t?.signal?.throwIfAborted();let{ctx:i,unlink:s}=o(t??{}),d=l(i,e);c(i,e,`start`),a(i,()=>d(`cancel`));try{let e=await u(n(i),t);return d(`done`),r?.(!1),e}catch(e){throw d(`error`,e),r?.(!0),e}finally{s()}},f=async(e,t)=>{let{ctx:n,unlink:r}=o(e);try{return await i(n,`run`,()=>t(n))}finally{r()}},p=e=>e,m=(e,t)=>n=>e(t,p(n)),h=e=>Array.isArray(e)?Array(e.length):{},g=(e,t)=>{let n=Object.entries(t).map(([t,n])=>{let r=o(e),a=()=>n(r.ctx);return{key:t,task:new Promise(e=>e(i(r.ctx,`run`,a))).finally(r.unlink),cancel:r.ctx.abort}});return{tasks:n.map(({key:e,task:t})=>[e,t]),cancelAll:()=>{for(let e of n)e.cancel()}}},_=(t,n)=>{if(t.length
|
|
1
|
+
import{i as e,n as t,r as n,t as r}from"./delay-Besb3X1O.js";import{a as i,c as a,i as o,l as s,o as c,t as l}from"./context-_HWcdjZf.js";const u=(e,t)=>t?.signal?new Promise((n,r)=>{let i=a(t,r);e.then(n,r).finally(i)}):e,d=async(e,t,n,r)=>{t?.signal?.throwIfAborted();let{ctx:i,unlink:s}=o(t??{}),d=l(i,e);c(i,e,`start`),a(i,()=>d(`cancel`));try{let e=await u(n(i),t);return d(`done`),r?.(!1),e}catch(e){throw d(`error`,e),r?.(!0),e}finally{s()}},f=async(e,t)=>{let{ctx:n,unlink:r}=o(e);try{return await i(n,`run`,()=>t(n))}finally{r()}},p=e=>e,m=(e,t)=>n=>e(t,p(n)),h=e=>Array.isArray(e)?Array(e.length):{},g=(e,t)=>{let n=Object.entries(t).map(([t,n])=>{let r=o(e),a=()=>n(r.ctx);return{key:t,task:new Promise(e=>e(i(r.ctx,`run`,a))).finally(r.unlink),cancel:r.ctx.abort}});return{tasks:n.map(({key:e,task:t})=>[e,t]),cancelAll:()=>{for(let e of n)e.cancel()}}},_=e=>{let t=e?.concurrency??1/0;if(t!==1/0&&!(Number.isInteger(t)&&t>=1))throw RangeError(`concurrency must be a positive integer`);return t},v=(e,t,n,r)=>{let a=Object.entries(t),s=[],c=a.map(([e])=>[e,new Promise(e=>s.push(e))]),l=/* @__PURE__ */ new Set,u=0,d=0,f=!1,p=()=>{for(;!f&&!e.signal.aborted&&d<n&&u<a.length;){let t=u++,[,n]=a[t],c=o(e),m=()=>n(c.ctx),h=()=>{c.unlink(),l.delete(c.ctx.abort),d--};l.add(c.ctx.abort),d++;let g=new Promise(e=>e(i(c.ctx,`run`,m))).then(e=>(h(),p(),e),e=>{throw h(),f=r,p(),e});s[t]?.(g)}};return p(),{tasks:c,cancelAll:()=>{f=!0;for(let e of l)e()}}},y=(t,n)=>{if(t.length!==1)return n(...t);let[r]=t;if(e(Reflect.get(r,`signal`)))throw TypeError(`A group takes effects: call it as (effects), or as (ctx, effects); a context alone has none`);return e=>n(e,r)},b=(e,t,n,r,i,a)=>{let o=_(a),s=()=>{};return d(e,t,async t=>{let i=o===1/0?g(t,n):v(t,n,o,e===`all`);return s=i.cancelAll,r(i.tasks)},e=>{(e||i===`end`)&&s()})};function x(...e){return y(e,S)}const S=(e,t,n)=>b(`all`,e,t,async e=>{let n=await Promise.all(e.map(([,e])=>e)),r=h(t);for(let[t,[i]]of e.entries())r[i]=n[t];return r},`failure`,n),C=e=>e.then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}));function w(...e){return y(e,T)}const T=(e,t,n)=>b(`allSettled`,e,t,async e=>{let n=await Promise.all(e.map(([,e])=>C(e))),r=h(t);for(let[t,[i]]of e.entries())r[i]=n[t];return r},`failure`,n),E=e=>e>0?e:0,D=(e={})=>{let t=E(e.base??100),n=e.factor??2,r=E(e.max??1/0),i=e.jitter??!1;return e=>{let a=E(Math.min(r,t*n**(e-1)));return i?Math.random()*a||0:a}},O=(e,t)=>e.signal.aborted?Promise.reject(e.signal.reason):new Promise((n,r)=>{let i=[],o=`pending`,c=e=>{try{e()}catch(e){s(`cancel cleanup failed`,e)}},l=a(e,e=>{o=`cancelled`;for(let e of i.reverse())c(e);r(e)}),u=e=>(...t)=>{o===`pending`&&(o=`settled`,l(),i.length=0,e(...t))},d=e=>{o===`pending`?i.push(e):o===`cancelled`&&c(e)};try{t({resolve:u(n),reject:u(r),onCancel:d})}catch(e){u(r)(e)}}),k=Symbol(`nanoeffects.effects.effect`),A=e=>t=>{let n=t.addContext,r=Object.entries(e);return t.addContext=e=>{n?.(e);for(let[t,n]of r){let r=Reflect.get(e,t);if(r===void 0||r[k]===n){let r=(...t)=>n(e,...t);r[k]=n,Reflect.set(e,t,r)}}},t},j=()=>/* @__PURE__ */ TypeError(`A Task is called as (payload, ctx), or as (ctx) when a group starts it; the single argument is not a context`),M=t=>{if(e(t)&&`signal`in t)return t;throw j()},N=(e,t,n)=>t===void 0?n(M(e),void 0):n(t,e),P=(e,r,i,o)=>{if(e.signal.aborted)return Promise.resolve();let s=o.leading??!1,c=o.waitForFn??!1;return d(`poll`,e,e=>new Promise((o,l)=>{let u=0,d=null,p=()=>{d!==null&&(t(d),d=null)},m=e=>{try{d=n(h,typeof i==`function`?i(e):i)}catch(e){p(),l(e)}},h=()=>{d=null,c||m(u+1),g()},g=()=>{let t=u++;f(e,e=>r(e,t)).then(()=>{c&&!e.signal.aborted&&m(u)},e=>{p(),l(e)})};a(e,p),s?(g(),c||m(u)):m(0)})).catch(t=>{if(!e.signal.aborted)throw t})};function F(e,t,n,r={}){if(typeof e!=`object`){let r=t,i=n??{},a=(t,n)=>P(t,m(r,n),e,i);return(e,t)=>N(e,t,a)}let i=t;return P(e,(e,t)=>i(t),n,r)}function I(...e){return y(e,L)}const L=(e,t)=>{let n=h(t);return Object.keys(t).length===0?Promise.resolve(n):b(`race`,e,t,async e=>{let[t,r]=await Promise.race(e.map(([e,t])=>t.then(t=>[e,t])));return n[t]=r,n},`end`)},R=(e,t,n)=>typeof e==`function`?e(t,n):e,z=e=>({times:e.times??3,delay:e.delay??0,shouldRetry:e.shouldRetry??(()=>!0)}),B=(e,t,n)=>d(`retry`,e,async e=>{let{times:i,delay:a,shouldRetry:o}=z(n);for(let n=1;;n++)try{return await f(e,e=>t(e,n))}catch(t){if(e.signal.throwIfAborted(),!(n<i)||!o(t,n))throw t;let s=R(a,n,t);s>0&&await r(e,s)}});function V(e,t,n={}){if(typeof e==`function`){let n=e,r=t??{},i=(e,t)=>B(e,m(n,t),r);return(e,t)=>N(e,t,i)}let r=t;return B(e,(e,t)=>r(t),n)}const H=(e,t,n={})=>d(`take`,e,r=>new Promise((i,o)=>{let{predicate:s}=n,c=[],l=()=>{for(let e of c)e()},u=e=>{l(),o(e)},d=t;c.push(e.on(d,e=>{(!s||s(e))&&(l(),i(e))})),c.push(a(r,u)),c.push(a({signal:n.signal},u))}));function U(t,n,r){if(e(t))return H(t,n,r);let i=n;return e=>H(e,t,i)}const W=(e,r,a)=>d(`timeout`,e,async e=>{let s=o(e),c=n(()=>s.ctx.abort(new DOMException(`Timed out after ${r}ms`,`TimeoutError`)),r);try{return await u(Promise.resolve(i(s.ctx,`run`,()=>a(s.ctx))),s.ctx)}finally{t(c),s.unlink()}});function G(e,t,n){if(typeof e==`number`){let n=t,r=(t,r)=>W(t,e,m(n,r));return(e,t)=>N(e,t,r)}return W(e,t,n)}export{x as all,w as allSettled,D as backoff,O as cancellable,r as delay,A as effectsPlugin,a as onAbort,F as poll,I as race,V as retry,U as take,G as timeout};
|
|
@@ -72,6 +72,11 @@ type Starter<T, Child = EffectContext> = (child: Child) => T | PromiseLike<T>;
|
|
|
72
72
|
* ```
|
|
73
73
|
*/
|
|
74
74
|
type StarterOf$1<E extends EventMap, R = unknown> = Starter<R, Context<E>>;
|
|
75
|
+
/** Options of `all` and `allSettled`. */
|
|
76
|
+
type GroupOptions = {
|
|
77
|
+
/** At most this many starters run at once; the next starts when one settles. Default: no limit. */
|
|
78
|
+
concurrency?: number | undefined;
|
|
79
|
+
};
|
|
75
80
|
//#endregion
|
|
76
81
|
//#region src/effects/all.d.ts
|
|
77
82
|
/**
|
|
@@ -91,10 +96,10 @@ type StarterOf$1<E extends EventMap, R = unknown> = Starter<R, Context<E>>;
|
|
|
91
96
|
*/
|
|
92
97
|
declare function all<C extends {
|
|
93
98
|
signal?: AbortSignal;
|
|
94
|
-
}, T extends Record<string, Starter<unknown, ChildOf<C>>>>(ctx: C, effects: T): Promise<{ [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
99
|
+
}, T extends Record<string, Starter<unknown, ChildOf<C>>>>(ctx: C, effects: T, options?: GroupOptions | null): Promise<{ [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
95
100
|
declare function all<C extends {
|
|
96
101
|
signal?: AbortSignal;
|
|
97
|
-
}, const T extends readonly Starter<unknown, ChildOf<C>>[]>(ctx: C, effects: T): Promise<{ -readonly [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
102
|
+
}, const T extends readonly Starter<unknown, ChildOf<C>>[]>(ctx: C, effects: T, options?: GroupOptions | null): Promise<{ -readonly [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
98
103
|
declare function all<Child, T extends Record<string, Starter<unknown, Child>>>(effects: T): (child: Child) => Promise<{ [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
99
104
|
declare function all<Child, const T extends readonly Starter<unknown, Child>[]>(effects: T): (child: Child) => Promise<{ -readonly [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
100
105
|
//#endregion
|
|
@@ -119,10 +124,10 @@ declare function all<Child, const T extends readonly Starter<unknown, Child>[]>(
|
|
|
119
124
|
*/
|
|
120
125
|
declare function allSettled<C extends {
|
|
121
126
|
signal?: AbortSignal;
|
|
122
|
-
}, T extends Record<string, Starter<unknown, ChildOf<C>>>>(ctx: C, effects: T): Promise<{ [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
127
|
+
}, T extends Record<string, Starter<unknown, ChildOf<C>>>>(ctx: C, effects: T, options?: GroupOptions | null): Promise<{ [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
123
128
|
declare function allSettled<C extends {
|
|
124
129
|
signal?: AbortSignal;
|
|
125
|
-
}, const T extends readonly Starter<unknown, ChildOf<C>>[]>(ctx: C, effects: T): Promise<{ -readonly [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
130
|
+
}, const T extends readonly Starter<unknown, ChildOf<C>>[]>(ctx: C, effects: T, options?: GroupOptions | null): Promise<{ -readonly [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
126
131
|
declare function allSettled<Child, T extends Record<string, Starter<unknown, Child>>>(effects: T): (child: Child) => Promise<{ [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
127
132
|
declare function allSettled<Child, const T extends readonly Starter<unknown, Child>[]>(effects: T): (child: Child) => Promise<{ -readonly [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
128
133
|
//#endregion
|
|
@@ -233,12 +238,12 @@ type Bound<E extends EventMap, Child> = {
|
|
|
233
238
|
<const T extends readonly Starter<unknown, Child>[]>(effects: T): Promise<{ -readonly [K in keyof T]?: Awaited<ReturnType<T[K]>>; }>;
|
|
234
239
|
};
|
|
235
240
|
all: {
|
|
236
|
-
<T extends Record<string, Starter<unknown, Child>>>(effects: T): Promise<{ [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
237
|
-
<const T extends readonly Starter<unknown, Child>[]>(effects: T): Promise<{ -readonly [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
241
|
+
<T extends Record<string, Starter<unknown, Child>>>(effects: T, options?: GroupOptions | null): Promise<{ [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
242
|
+
<const T extends readonly Starter<unknown, Child>[]>(effects: T, options?: GroupOptions | null): Promise<{ -readonly [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
238
243
|
};
|
|
239
244
|
allSettled: {
|
|
240
|
-
<T extends Record<string, Starter<unknown, Child>>>(effects: T): Promise<{ [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
241
|
-
<const T extends readonly Starter<unknown, Child>[]>(effects: T): Promise<{ -readonly [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
245
|
+
<T extends Record<string, Starter<unknown, Child>>>(effects: T, options?: GroupOptions | null): Promise<{ [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
246
|
+
<const T extends readonly Starter<unknown, Child>[]>(effects: T, options?: GroupOptions | null): Promise<{ -readonly [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
242
247
|
};
|
|
243
248
|
take: {
|
|
244
249
|
<K extends Keys<E>>(event: K, options?: TakeOptions<E[K]>): Promise<E[K]>;
|
|
@@ -280,4 +285,4 @@ type StarterOf<H extends Helpers, E extends EventMap> = Context<E> & BoundOf<H,
|
|
|
280
285
|
*/
|
|
281
286
|
declare const effectsPlugin: <H extends Helpers>(helpers: H) => <E extends EventMap>(bus: Bus<E> & NoClash<BoundOf<H, E>, E>) => Bus<E & WithContext<BoundOf<H, E>>>;
|
|
282
287
|
//#endregion
|
|
283
|
-
export { RaceStarter as a, all as c,
|
|
288
|
+
export { RaceStarter as a, all as c, GroupOptions as d, Starter as f, take as i, ChildOf as l, delay as m, effectsPlugin as n, race as o, StarterOf$1 as p, TakeOptions as r, allSettled as s, BoundOf as t, EffectContext as u };
|
|
@@ -66,6 +66,11 @@ type Starter<T, Child = EffectContext> = (child: Child) => T | PromiseLike<T>;
|
|
|
66
66
|
* ```
|
|
67
67
|
*/
|
|
68
68
|
type StarterOf$1<E extends EventMap, R = unknown> = Starter<R, Context<E>>;
|
|
69
|
+
/** Options of `all` and `allSettled`. */
|
|
70
|
+
type GroupOptions = {
|
|
71
|
+
/** At most this many starters run at once; the next starts when one settles. Default: no limit. */
|
|
72
|
+
concurrency?: number | undefined;
|
|
73
|
+
};
|
|
69
74
|
//#endregion
|
|
70
75
|
//#region src/effects/all.d.ts
|
|
71
76
|
/**
|
|
@@ -85,10 +90,10 @@ type StarterOf$1<E extends EventMap, R = unknown> = Starter<R, Context<E>>;
|
|
|
85
90
|
*/
|
|
86
91
|
declare function all<C extends {
|
|
87
92
|
signal?: AbortSignal;
|
|
88
|
-
}, T extends Record<string, Starter<unknown, ChildOf<C>>>>(ctx: C, effects: T): Promise<{ [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
93
|
+
}, T extends Record<string, Starter<unknown, ChildOf<C>>>>(ctx: C, effects: T, options?: GroupOptions | null): Promise<{ [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
89
94
|
declare function all<C extends {
|
|
90
95
|
signal?: AbortSignal;
|
|
91
|
-
}, const T extends readonly Starter<unknown, ChildOf<C>>[]>(ctx: C, effects: T): Promise<{ -readonly [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
96
|
+
}, const T extends readonly Starter<unknown, ChildOf<C>>[]>(ctx: C, effects: T, options?: GroupOptions | null): Promise<{ -readonly [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
92
97
|
declare function all<Child, T extends Record<string, Starter<unknown, Child>>>(effects: T): (child: Child) => Promise<{ [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
93
98
|
declare function all<Child, const T extends readonly Starter<unknown, Child>[]>(effects: T): (child: Child) => Promise<{ -readonly [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
94
99
|
//#endregion
|
|
@@ -113,10 +118,10 @@ declare function all<Child, const T extends readonly Starter<unknown, Child>[]>(
|
|
|
113
118
|
*/
|
|
114
119
|
declare function allSettled<C extends {
|
|
115
120
|
signal?: AbortSignal;
|
|
116
|
-
}, T extends Record<string, Starter<unknown, ChildOf<C>>>>(ctx: C, effects: T): Promise<{ [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
121
|
+
}, T extends Record<string, Starter<unknown, ChildOf<C>>>>(ctx: C, effects: T, options?: GroupOptions | null): Promise<{ [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
117
122
|
declare function allSettled<C extends {
|
|
118
123
|
signal?: AbortSignal;
|
|
119
|
-
}, const T extends readonly Starter<unknown, ChildOf<C>>[]>(ctx: C, effects: T): Promise<{ -readonly [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
124
|
+
}, const T extends readonly Starter<unknown, ChildOf<C>>[]>(ctx: C, effects: T, options?: GroupOptions | null): Promise<{ -readonly [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
120
125
|
declare function allSettled<Child, T extends Record<string, Starter<unknown, Child>>>(effects: T): (child: Child) => Promise<{ [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
121
126
|
declare function allSettled<Child, const T extends readonly Starter<unknown, Child>[]>(effects: T): (child: Child) => Promise<{ -readonly [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
122
127
|
//#endregion
|
|
@@ -227,12 +232,12 @@ type Bound<E extends EventMap, Child> = {
|
|
|
227
232
|
<const T extends readonly Starter<unknown, Child>[]>(effects: T): Promise<{ -readonly [K in keyof T]?: Awaited<ReturnType<T[K]>>; }>;
|
|
228
233
|
};
|
|
229
234
|
all: {
|
|
230
|
-
<T extends Record<string, Starter<unknown, Child>>>(effects: T): Promise<{ [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
231
|
-
<const T extends readonly Starter<unknown, Child>[]>(effects: T): Promise<{ -readonly [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
235
|
+
<T extends Record<string, Starter<unknown, Child>>>(effects: T, options?: GroupOptions | null): Promise<{ [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
236
|
+
<const T extends readonly Starter<unknown, Child>[]>(effects: T, options?: GroupOptions | null): Promise<{ -readonly [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
|
|
232
237
|
};
|
|
233
238
|
allSettled: {
|
|
234
|
-
<T extends Record<string, Starter<unknown, Child>>>(effects: T): Promise<{ [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
235
|
-
<const T extends readonly Starter<unknown, Child>[]>(effects: T): Promise<{ -readonly [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
239
|
+
<T extends Record<string, Starter<unknown, Child>>>(effects: T, options?: GroupOptions | null): Promise<{ [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
240
|
+
<const T extends readonly Starter<unknown, Child>[]>(effects: T, options?: GroupOptions | null): Promise<{ -readonly [K in keyof T]: PromiseSettledResult<Awaited<ReturnType<T[K]>>>; }>;
|
|
236
241
|
};
|
|
237
242
|
take: {
|
|
238
243
|
<K extends Keys<E>>(event: K, options?: TakeOptions<E[K]>): Promise<E[K]>;
|
|
@@ -274,4 +279,4 @@ type StarterOf<H extends Helpers, E extends EventMap> = Context<E> & BoundOf<H,
|
|
|
274
279
|
*/
|
|
275
280
|
declare const effectsPlugin: <H extends Helpers>(helpers: H) => <E extends EventMap>(bus: Bus<E> & NoClash<BoundOf<H, E>, E>) => Bus<E & WithContext<BoundOf<H, E>>>;
|
|
276
281
|
//#endregion
|
|
277
|
-
export { RaceStarter as a, all as c,
|
|
282
|
+
export { RaceStarter as a, all as c, GroupOptions as d, Starter as f, take as i, ChildOf as l, delay as m, effectsPlugin as n, race as o, StarterOf$1 as p, TakeOptions as r, allSettled as s, BoundOf as t, EffectContext as u };
|
package/dist/scope.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as WithSignal, a as EmitScope, d as Effects, f as Signaled, h as Bus, o as Scope, u as Effect, z as EventMap } from "./action-creator-Bpa8BUS9.js";
|
|
2
|
-
import { n as ScopeSlots, r as Scoped } from "./types-
|
|
2
|
+
import { n as ScopeSlots, r as Scoped } from "./types-DWjyeii7.js";
|
|
3
3
|
//#region src/scope/effect.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Marks a function whose first parameter is `{ signal }` as an effect, so that
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as Effects, o as Scope, s as WithFields, z as EventMap } from "./action-creator-Bpa8BUS9.js";
|
|
2
|
-
import { t as BoundOf } from "./plugin-
|
|
2
|
+
import { t as BoundOf } from "./plugin-B6UQyoVd.js";
|
|
3
3
|
//#region src/scope/types.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* The slots `scopePlugin` fills for `modulePlugin`. They are not on `Bus`: a bus
|
package/docs/effects.md
CHANGED
|
@@ -376,6 +376,29 @@ bus.on("open", async (id, ctx) => {
|
|
|
376
376
|
|
|
377
377
|
One argument is the short form and two arguments are the form with `ctx`: `all(effects)` returns a starter, `all(ctx, effects)` runs the group. The inner group stops with the outer one and cancels its own starters. Passing only a context, `all(ctx)`, is a mistake and throws a `TypeError` at once. A group starter written in a group needs no type. One kept in a variable outside a group does not know its bus: in TypeScript, annotate it with `StarterOf<Events>`, or `StarterOf<Events, Result>` when you need its value.
|
|
378
378
|
|
|
379
|
+
**Limit how many run at once.** `all` and `allSettled` start every starter together. Over a long list that is a burst of requests. Pass `{ concurrency }` as the third argument and at most that many run at a time; the next one starts when a running one settles:
|
|
380
|
+
|
|
381
|
+
```js
|
|
382
|
+
import { createBus } from "nanoeffects";
|
|
383
|
+
import { all, retry } from "nanoeffects/effects";
|
|
384
|
+
|
|
385
|
+
const bus = createBus();
|
|
386
|
+
|
|
387
|
+
bus.on("sync", async (ids, ctx) => {
|
|
388
|
+
// all with concurrency — 5 loads at a time, results in the order of ids
|
|
389
|
+
const users = await all(
|
|
390
|
+
ctx,
|
|
391
|
+
ids.map((id) => retry(() => loadUser(id), { times: 2 })),
|
|
392
|
+
{ concurrency: 5 },
|
|
393
|
+
);
|
|
394
|
+
|
|
395
|
+
render(users);
|
|
396
|
+
});
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
The result has the same order and shape as without the option. If one starter of `all` fails, the running ones are cancelled and the waiting ones are never called. `allSettled` goes on after a failure. When `ctx` aborts, both stop and start nothing more. A value that is not a positive integer (`0`, `-1`, `NaN`, `1.5`) throws a `RangeError` before anything starts; `Infinity` means no limit. `race` has no `concurrency`: it ends at the first result, so a starter that waited for a free slot would never run. A group starter inside another group takes no options; write `(child) => all(child, effects, { concurrency: 5 })` there.
|
|
400
|
+
|
|
401
|
+
|
|
379
402
|
**A starter gets the context of its own child task.** Pass `child` as the first argument to any effect, as a handler passes `ctx`: when the race ends, `child` is aborted and stops exactly this effect. The outer `ctx` is only for `race` itself. Your own API takes the signal in its options: `({ signal }) => fetchUser(id, { signal })`. The same holds for `all`, `allSettled` and `timeout`.
|
|
380
403
|
|
|
381
404
|
If `ctx` is `{}` or a bare `{ signal }` (outside a task), `child` has only `signal` and `abort`, so it fits `delay` and `poll` but not `take`, which needs a bus.
|
package/llms-full.txt
CHANGED
|
@@ -1972,6 +1972,29 @@ bus.on("open", async (id, ctx) => {
|
|
|
1972
1972
|
|
|
1973
1973
|
One argument is the short form and two arguments are the form with `ctx`: `all(effects)` returns a starter, `all(ctx, effects)` runs the group. The inner group stops with the outer one and cancels its own starters. Passing only a context, `all(ctx)`, is a mistake and throws a `TypeError` at once. A group starter written in a group needs no type. One kept in a variable outside a group does not know its bus: in TypeScript, annotate it with `StarterOf<Events>`, or `StarterOf<Events, Result>` when you need its value.
|
|
1974
1974
|
|
|
1975
|
+
**Limit how many run at once.** `all` and `allSettled` start every starter together. Over a long list that is a burst of requests. Pass `{ concurrency }` as the third argument and at most that many run at a time; the next one starts when a running one settles:
|
|
1976
|
+
|
|
1977
|
+
```js
|
|
1978
|
+
import { createBus } from "nanoeffects";
|
|
1979
|
+
import { all, retry } from "nanoeffects/effects";
|
|
1980
|
+
|
|
1981
|
+
const bus = createBus();
|
|
1982
|
+
|
|
1983
|
+
bus.on("sync", async (ids, ctx) => {
|
|
1984
|
+
// all with concurrency — 5 loads at a time, results in the order of ids
|
|
1985
|
+
const users = await all(
|
|
1986
|
+
ctx,
|
|
1987
|
+
ids.map((id) => retry(() => loadUser(id), { times: 2 })),
|
|
1988
|
+
{ concurrency: 5 },
|
|
1989
|
+
);
|
|
1990
|
+
|
|
1991
|
+
render(users);
|
|
1992
|
+
});
|
|
1993
|
+
```
|
|
1994
|
+
|
|
1995
|
+
The result has the same order and shape as without the option. If one starter of `all` fails, the running ones are cancelled and the waiting ones are never called. `allSettled` goes on after a failure. When `ctx` aborts, both stop and start nothing more. A value that is not a positive integer (`0`, `-1`, `NaN`, `1.5`) throws a `RangeError` before anything starts; `Infinity` means no limit. `race` has no `concurrency`: it ends at the first result, so a starter that waited for a free slot would never run. A group starter inside another group takes no options; write `(child) => all(child, effects, { concurrency: 5 })` there.
|
|
1996
|
+
|
|
1997
|
+
|
|
1975
1998
|
**A starter gets the context of its own child task.** Pass `child` as the first argument to any effect, as a handler passes `ctx`: when the race ends, `child` is aborted and stops exactly this effect. The outer `ctx` is only for `race` itself. Your own API takes the signal in its options: `({ signal }) => fetchUser(id, { signal })`. The same holds for `all`, `allSettled` and `timeout`.
|
|
1976
1999
|
|
|
1977
2000
|
If `ctx` is `{}` or a bare `{ signal }` (outside a task), `child` has only `signal` and `abort`, so it fits `delay` and `poll` but not `take`, which needs a bus.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nanoeffects",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Cancel stale async work and fix race conditions in event handlers: a typed event bus where every handler is a task with an AbortSignal, plus latest, debounce, throttle, queue, retry, timeout and poll. About 1.4 kB gzip.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"event-bus",
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
{
|
|
221
221
|
"name": "effects (all)",
|
|
222
222
|
"path": "dist/effects.js",
|
|
223
|
-
"limit": "
|
|
223
|
+
"limit": "3 kB"
|
|
224
224
|
},
|
|
225
225
|
{
|
|
226
226
|
"name": "actions (all)",
|