mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 16:48:50 +00:00
a better way to do pubs and subs with SimplePool.
This commit is contained in:
8
pool.ts
8
pool.ts
@@ -4,14 +4,10 @@ import {Filter} from './filter'
|
||||
import {Event} from './event'
|
||||
import {SubscriptionOptions, Sub, Pub} from './relay'
|
||||
|
||||
export function pool(defaultRelays: string[] = []) {
|
||||
return new SimplePool(defaultRelays)
|
||||
}
|
||||
|
||||
class SimplePool {
|
||||
export class SimplePool {
|
||||
private _conn: {[url: string]: Relay}
|
||||
|
||||
constructor(defaultRelays: string[]) {
|
||||
constructor(defaultRelays: string[] = []) {
|
||||
this._conn = {}
|
||||
defaultRelays.forEach(this.ensureRelay)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user