feat: request builder option fillStore

This commit is contained in:
Kieran 2024-01-18 13:06:52 +00:00
parent f20cd8a119
commit 3ff651ec37
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
2 changed files with 11 additions and 1 deletions

View File

@ -393,7 +393,11 @@ export class Query extends EventEmitter<QueryEvents> {
responseTime: qt.responseTime,
} as TraceReport),
);
const handler = (sub: string, ev: TaggedNostrEvent) => this.handleEvent(sub, ev);
const handler = (sub: string, ev: TaggedNostrEvent) => {
if (this.request.options?.fillStore ?? true) {
this.handleEvent(sub, ev);
}
};
c.on("event", handler);
this.on("end", () => c.off("event", handler));
this.#tracing.push(qt);

View File

@ -58,6 +58,12 @@ export interface RequestBuilderOptions {
* How many milli-seconds to wait to allow grouping
*/
groupingDelay?: number;
/**
* If events should be added automatically to the internal NoteCollection
* default=true
*/
fillStore?: boolean;
}
/**