Fix global
This commit is contained in:
@ -17,7 +17,7 @@ export default function useTimelineFeed(pubKeys: HexKey | Array<HexKey>, global:
|
|||||||
|
|
||||||
let sub = new Subscriptions();
|
let sub = new Subscriptions();
|
||||||
sub.Id = `timeline:${subTab}`;
|
sub.Id = `timeline:${subTab}`;
|
||||||
sub.Authors = new Set(global ? [] : pubKeys);
|
sub.Authors = global ? undefined : new Set(pubKeys);
|
||||||
sub.Kinds = new Set([EventKind.TextNote, EventKind.Repost]);
|
sub.Kinds = new Set([EventKind.TextNote, EventKind.Repost]);
|
||||||
sub.Limit = 20;
|
sub.Limit = 20;
|
||||||
|
|
||||||
|
@ -15,42 +15,42 @@ export class Subscriptions {
|
|||||||
/**
|
/**
|
||||||
* a list of event ids or prefixes
|
* a list of event ids or prefixes
|
||||||
*/
|
*/
|
||||||
Ids: Set<u256> | null
|
Ids?: Set<u256>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a list of pubkeys or prefixes, the pubkey of an event must be one of these
|
* a list of pubkeys or prefixes, the pubkey of an event must be one of these
|
||||||
*/
|
*/
|
||||||
Authors: Set<u256> | null;
|
Authors?: Set<u256>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a list of a kind numbers
|
* a list of a kind numbers
|
||||||
*/
|
*/
|
||||||
Kinds: Set<EventKind> | null;
|
Kinds?: Set<EventKind>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a list of event ids that are referenced in an "e" tag
|
* a list of event ids that are referenced in an "e" tag
|
||||||
*/
|
*/
|
||||||
ETags: Set<u256> | null;
|
ETags?: Set<u256>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a list of pubkeys that are referenced in a "p" tag
|
* a list of pubkeys that are referenced in a "p" tag
|
||||||
*/
|
*/
|
||||||
PTags: Set<u256> | null;
|
PTags?: Set<u256>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a timestamp, events must be newer than this to pass
|
* a timestamp, events must be newer than this to pass
|
||||||
*/
|
*/
|
||||||
Since: number | null;
|
Since?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a timestamp, events must be older than this to pass
|
* a timestamp, events must be older than this to pass
|
||||||
*/
|
*/
|
||||||
Until: number | null;
|
Until?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* maximum number of events to be returned in the initial query
|
* maximum number of events to be returned in the initial query
|
||||||
*/
|
*/
|
||||||
Limit: number | null;
|
Limit?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler function for this event
|
* Handler function for this event
|
||||||
@ -79,14 +79,14 @@ export class Subscriptions {
|
|||||||
|
|
||||||
constructor(sub?: RawReqFilter) {
|
constructor(sub?: RawReqFilter) {
|
||||||
this.Id = uuid();
|
this.Id = uuid();
|
||||||
this.Ids = sub?.ids ? new Set(sub.ids) : null;
|
this.Ids = sub?.ids ? new Set(sub.ids) : undefined;
|
||||||
this.Authors = sub?.authors ? new Set(sub.authors) : null;
|
this.Authors = sub?.authors ? new Set(sub.authors) : undefined;
|
||||||
this.Kinds = sub?.kinds ? new Set(sub.kinds) : null;
|
this.Kinds = sub?.kinds ? new Set(sub.kinds) : undefined;
|
||||||
this.ETags = sub?.["#e"] ? new Set(sub["#e"]) : null;
|
this.ETags = sub?.["#e"] ? new Set(sub["#e"]) : undefined;
|
||||||
this.PTags = sub?.["#p"] ? new Set(sub["#p"]) : null;
|
this.PTags = sub?.["#p"] ? new Set(sub["#p"]) : undefined;
|
||||||
this.Since = sub?.since ?? null;
|
this.Since = sub?.since ?? undefined;
|
||||||
this.Until = sub?.until ?? null;
|
this.Until = sub?.until ?? undefined;
|
||||||
this.Limit = sub?.limit ?? null;
|
this.Limit = sub?.limit ?? undefined;
|
||||||
this.OnEvent = (e) => { console.warn(`No event handler was set on subscription: ${this.Id}`) };
|
this.OnEvent = (e) => { console.warn(`No event handler was set on subscription: ${this.Id}`) };
|
||||||
this.OnEnd = (c) => { };
|
this.OnEnd = (c) => { };
|
||||||
this.OrSubs = [];
|
this.OrSubs = [];
|
||||||
|
Reference in New Issue
Block a user