mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-11 09:38:51 +00:00
Expose relay funcs (#31)
This commit is contained in:
committed by
GitHub
parent
ae717a1a4a
commit
1b798b2eee
14
pool.js
14
pool.js
@@ -144,6 +144,20 @@ export function relayPool() {
|
||||
relay.close()
|
||||
delete relays[relayURL]
|
||||
},
|
||||
//getRelayList return an array with all the relays stored
|
||||
getRelayList() {
|
||||
return Object.values(relays)
|
||||
},
|
||||
|
||||
relayChangePolicy(url, policy = {read: true, write: true}) {
|
||||
let relayURL = normalizeRelayURL(url)
|
||||
let data = relays[relayURL]
|
||||
if (!data) return
|
||||
|
||||
relays[relayURL].policy = policy
|
||||
|
||||
return relays[relayURL]
|
||||
},
|
||||
onNotice(cb) {
|
||||
noticeCallbacks.push(cb)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user