Commit Graph

121 Commits

Author SHA1 Message Date
Jon Staab e2f438799f Make outbox loader useful for non plain replaceables, add tap and bind 2026-02-18 15:27:34 -08:00
Jon Staab 119cb6248b Fix task queue 2026-02-09 10:02:02 -08:00
Jon Staab 99c1d09b62 Various optimizations 2026-02-05 17:48:29 -08:00
Jon Staab 1ce053b26f Stringify supported nips 2026-01-26 10:08:37 -08:00
Jon Staab 1c0204c17c Add switch_relays to nip 46 signer 2026-01-20 12:56:17 -08:00
Jon Staab e9b1172d15 Add doLet util 2025-12-17 17:43:35 -08:00
Jon Staab 780148a31e Add a few utils, fix relay fetching 2025-12-12 13:28:48 -08:00
Jon Staab d81ec62d2b Add since to reqs that get re-opened to avoid re-downloading and gaps in active subscriptions. Also add some getters for event stores and event sort utils 2025-12-04 15:16:56 -08:00
Jon Staab 351b60631e Move key stuff to util, add pow util 2025-12-02 13:15:24 -08:00
Jon Staab 52785afb10 Fix some bugs 2025-11-25 14:54:10 -08:00
Jon Staab 250f5c772f Fix some bugs with deriving events by url 2025-11-24 09:52:47 -08:00
Jon Staab 2fec078a5b Update docs, tweak url based event derivation 2025-11-20 15:08:59 -08:00
Jon Staab de5695339d 1. throttle (line 1146-1174)
Before: Used recursive setTimeout calls via unpause, creating nested closures and multiple timer contexts.

After:
- Tracks a single timeoutId to manage timer lifecycle
- Eliminates nested closure creation
- Cleaner timer chain when calls are pending

2. batch (line 1204-1227)

Before: Used throttle internally, inheriting its timer overhead.

After:
- Direct timer management without the throttle wrapper
- Single timeoutId tracked explicitly
- Maintains the same semantics (first item processed immediately, rest batched)

3. batcher (line 1235-1259)

Before:
- Created new timer every time queue went from empty to non-empty
- Had unnecessary async in forEach and await r when r was already type U

After:
- Tracks timeoutId to prevent duplicate timer creation
- Only creates timer when queue is truly empty
- Removed unnecessary async/await in result handling
- More efficient error handling (rejects all items at once if length mismatch)

Performance Benefits:

These changes should significantly reduce timer overhead by:
- Fewer timer objects: Only one active timer per throttled/batched function instead of chains
- Less garbage collection: Fewer closure allocations and intermediate objects
- Better memory usage: Explicit timer ID tracking instead of implicit state in closures
2025-11-14 15:29:03 -08:00
Jon Staab 24860c9a02 Add prepend util 2025-11-12 11:06:13 -08:00
Jon Staab e582d46afd Break down relay utils, replace removeNil with removeUndefined 2025-11-11 14:05:30 -08:00
Jon Staab 4c1c138329 Forget about null, use undefined 2025-11-06 12:10:24 -08:00
Jon Staab 8426febcdf Memoize some stores, improve room support 2025-11-03 13:26:47 -08:00
Jon Staab 3132b8c59a Make sorting/limit more resilient in repository 2025-10-28 13:23:25 -07:00
Jon Staab a03a289e93 Improve relay tracking with thunks, add/rename some kinds 2025-10-24 06:41:56 -07:00
Jon Staab 247c7bafeb Add wrap manager for tracking gift wraps 2025-10-20 14:19:44 -07:00
Jon Staab 543dbda64f Make thunks an array instead of an object 2025-10-20 14:19:44 -07:00
Jon Staab d4a6873ed5 Generalize some utils 2025-10-13 13:41:53 -07:00
Jon Staab 5c03ff3e29 Pass pubkey to nip 55 signer to avoid mixing up sessions 2025-10-13 11:20:01 -07:00
Jon Staab 0ada7d4b29 Optimize some utils 2025-10-03 10:11:07 -07:00
Jon Staab 599e6a5085 Add some type utils, findFeed, and fix feed listener to use limit: 0 instead of since 2025-09-09 16:20:21 -07:00
Jon Staab 3b99cb7d4c Fix throttle function, add retryAuth 2025-09-03 17:31:19 -07:00
Jon Staab 00c0497892 Add anonymous session, re-work thunk utilities 2025-08-19 14:03:28 -07:00
Jon Staab 3b4fe0973d Validate url in fetch, rework some hints 2025-08-05 17:26:18 -07:00
Jon Staab 24acae704d Improve socket auth, outbox loading, some other things 2025-06-19 12:51:05 -07:00
Jon Staab 4cabf53c2f Add docs for blossom, add nip 86 and 98 support 2025-06-10 13:18:03 -07:00
Jon Staab d13ea745ff Add blossom support 2025-06-06 16:35:46 -07:00
Jon Staab bc65b96d46 Sort events in deriveEventsMapped, bump nostr-tools 2025-06-06 12:55:03 -07:00
Jon Staab d2ba0f6642 Add bufferToHex, re-export some stuff from nostr-editor 2025-05-09 12:31:14 -07:00
Jon Staab bfa2ac4f53 Remove nip46 broker getter, since websocket connections were getting closed and interrupting login flows 2025-05-07 13:50:48 -07:00
Jon Staab f20eab929e Remove app date functions 2025-04-30 14:14:03 -07:00
Jon Staab b3e8d7a332 Tweak feed display 2025-04-25 17:17:18 -07:00
Jon Staab 4031564c6c Add feed validation and display 2025-04-24 09:40:22 -07:00
Jon Staab 2996e25359 Split router out into its own library 2025-04-23 13:34:04 -07:00
Jon Staab c5ea7edf6b Rework storage adapters 2025-04-16 12:54:34 -07:00
Jon Staab ded668890f Fix docs/tests 2025-04-14 13:18:49 -07:00
Jon Staab e54cb0a62d re-work thunks 2025-04-14 13:10:20 -07:00
Jon Staab 859f7fa68f Improve feed loader, wait for db before executing reads/updates, make taskQueue subscribable, add race, rename auth methods, fix failed wasm verify, fix localhost urls 2025-04-09 15:39:07 -07:00
Jon Staab 1bcc57d695 Add poll utility 2025-04-09 13:47:59 -07:00
Jon Staab 728ad1fba0 Lint 2025-04-09 11:58:29 -07:00
Jon Staab 8e585fc150 Delete readmes, update docs 2025-04-09 11:17:12 -07:00
Jon Staab 02202d298e Tweak docs 2025-04-08 14:43:12 -07:00
Jon Staab 35f75bb38e Get rid of typed emitter 2025-04-02 08:54:50 -07:00
Jon Staab 04816f8377 Get rid of Worker, use TaskQueue instead 2025-03-31 15:55:10 -07:00
Jon Staab 1524d128e3 Fix ts errors 2025-03-31 12:49:28 -07:00
Jon Staab d7b74d2c7e Minor net2 cleanup 2025-03-27 11:07:25 -07:00