UNPKG

@hazae41/plume

Version:

Typed async events with sequenced and parallel dispatching

1 lines 704 B
{"version":3,"file":"closed.cjs","sources":["../../../../src/mods/closed.ts"],"sourcesContent":["import { Future } from \"@hazae41/future\"\nimport { SuperEventTarget } from \"./target.js\"\n\nexport type CloseEvents = {\n close: (reason?: unknown) => void\n}\n\nexport function rejectOnClose<M extends CloseEvents>(target: SuperEventTarget<M>) {\n return target.wait(\"close\", (future: Future<never>, ...[cause]) => future.reject(new Error(\"Closed\", { cause })))\n}"],"names":[],"mappings":";;AAOM,SAAU,aAAa,CAAwB,MAA2B,EAAA;AAC9E,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,MAAqB,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AACnH;;;;"}