Add abortThunk, bump versions

This commit is contained in:
Jon Staab
2025-01-29 10:08:58 -08:00
parent 5522d7d2a0
commit 369a89dc60
6 changed files with 20 additions and 8 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@welshman/app",
"version": "0.0.41",
"version": "0.0.42",
"author": "hodlbod",
"license": "MIT",
"description": "A collection of svelte stores for use in building nostr client applications.",
@@ -29,7 +29,7 @@
"@types/throttle-debounce": "^5.0.2",
"@welshman/dvm": "~0.0.13",
"@welshman/feeds": "~0.0.30",
"@welshman/lib": "~0.0.37",
"@welshman/lib": "~0.0.39",
"@welshman/net": "~0.0.46",
"@welshman/signer": "~0.0.19",
"@welshman/store": "~0.0.15",
+7 -1
View File
@@ -1,6 +1,6 @@
import {writable, derived, get} from "svelte/store"
import type {Writable, Readable} from "svelte/store"
import {Worker, identity, uniq, defer, sleep, assoc} from "@welshman/lib"
import {Worker, dissoc, identity, uniq, defer, sleep, assoc} from "@welshman/lib"
import type {Deferred} from "@welshman/lib"
import {stamp, own, hash} from "@welshman/signer"
import type {
@@ -164,6 +164,12 @@ export const publishThunks = (requests: ThunkRequest[]) => {
return mergedThunk
}
export const abortThunk = (thunk: Thunk) => {
thunk.controller.abort()
thunks.update(dissoc(thunk.event.id))
repository.removeEvent(thunk.event.id)
}
export const thunkWorker = new Worker<Thunk>()
thunkWorker.addGlobalHandler((thunk: Thunk) => {