Why Nostr? What is Njump?
2024-09-04 02:50:32

SnowCait on Nostr: Promise.withResolvers の使い方これでいいんだろうか async function ...

Promise.withResolvers の使い方これでいいんだろうか

async function send(relays: string[], event: Event): Promise<void> {
const { promise, resolve } = Promise.withResolvers<void>();
const rxNostr = createRxNostr({ verifier, okTimeout });
rxNostr.setDefaultRelays(relays);
rxNostr
.send(event, { completeOn: "all-ok", errorOnTimeout: false })
.subscribe({ complete: () => resolve });
return promise;
}
Author Public Key
npub1s02jksmr6tgmcksf3hnmue7pyzlm0sxwarh7lk8tdeprw2hjg6ysp7fxtw