This commit is contained in:
parent
c2e1215667
commit
7b72f9f775
@ -13,18 +13,23 @@ The main hook which allows you to subscribe to nostr relays and returns a reacti
|
|||||||
Profile hook, profile loading is automated, this hook will return the profile from cache and also refresh the cache in the background (`stale-while-revalidate`)
|
Profile hook, profile loading is automated, this hook will return the profile from cache and also refresh the cache in the background (`stale-while-revalidate`)
|
||||||
|
|
||||||
#### `useEventFeed(NostrLink)` / `useEventsFeed(Array<NostrLink>)`
|
#### `useEventFeed(NostrLink)` / `useEventsFeed(Array<NostrLink>)`
|
||||||
|
|
||||||
A simple hook which can load events using the `NostrLink` class, this class contains one NIP-19 entity `nevent/naddr` etc.
|
A simple hook which can load events using the `NostrLink` class, this class contains one NIP-19 entity `nevent/naddr` etc.
|
||||||
|
|
||||||
#### `useReactions(id, Array<NostrLink>)`
|
#### `useReactions(id, Array<NostrLink>)`
|
||||||
|
|
||||||
Loads reactions for a set of events, this can be a set of posts on a profile or an arbitary list of events.
|
Loads reactions for a set of events, this can be a set of posts on a profile or an arbitary list of events.
|
||||||
|
|
||||||
#### `useEventReactions(NostrLink, Array<NostrEvent>)`
|
#### `useEventReactions(NostrLink, Array<NostrEvent>)`
|
||||||
|
|
||||||
Process a set of related events (usually results from `useReactions`) and return likes/dislikes/reposts/zaps
|
Process a set of related events (usually results from `useReactions`) and return likes/dislikes/reposts/zaps
|
||||||
|
|
||||||
#### `useUserSearch()`
|
#### `useUserSearch()`
|
||||||
|
|
||||||
Search for profiles in the profile cache, this also returns exact links if they match
|
Search for profiles in the profile cache, this also returns exact links if they match
|
||||||
|
|
||||||
#### `useSystemState(System)`
|
#### `useSystemState(System)`
|
||||||
|
|
||||||
Hook state of the nostr system
|
Hook state of the nostr system
|
||||||
|
|
||||||
## Example:
|
## Example:
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
|
|
||||||
export const enum NostrSystemCommand {
|
export const enum NostrSystemCommand {
|
||||||
OkResponse,
|
OkResponse,
|
||||||
ErrorResponse,
|
ErrorResponse,
|
||||||
Init,
|
Init,
|
||||||
ConnectRelay,
|
ConnectRelay,
|
||||||
DisconnectRelay
|
DisconnectRelay,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NostrSystemMessage<T> {
|
export interface NostrSystemMessage<T> {
|
||||||
|
@ -41,7 +41,7 @@ globalThis.onmessage = async ev => {
|
|||||||
}
|
}
|
||||||
case NostrSystemCommand.ConnectRelay: {
|
case NostrSystemCommand.ConnectRelay: {
|
||||||
checkInitialized();
|
checkInitialized();
|
||||||
const cmd = ev.data as NostrSystemMessage<[string, {read: boolean, write: boolean}]>;
|
const cmd = ev.data as NostrSystemMessage<[string, { read: boolean; write: boolean }]>;
|
||||||
await system?.ConnectToRelay(cmd.data[0], cmd.data[1]);
|
await system?.ConnectToRelay(cmd.data[0], cmd.data[1]);
|
||||||
okReply(data.id, "Connected");
|
okReply(data.id, "Connected");
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user