Move limit to GetFilterOpts
This commit is contained in:
parent
bbaf1cb012
commit
96641a6fa0
|
@ -50,8 +50,7 @@ function getFilters<K extends number>(filters: Filter<K>[], opts: GetFiltersOpts
|
|||
sig: event.sig,
|
||||
});
|
||||
}
|
||||
// HACK
|
||||
if (filters.length === 1 && filters[0].limit && results.length >= filters[0].limit) {
|
||||
if (typeof opts.limit === 'number' && results.length >= opts.limit) {
|
||||
unsub();
|
||||
clearTimeout(tid);
|
||||
resolve(results as SignedEvent<K>[]);
|
||||
|
|
|
@ -7,7 +7,10 @@ interface DittoFilter<K extends number = number> extends Filter<K> {
|
|||
|
||||
/** Additional options to apply to the whole subscription. */
|
||||
interface GetFiltersOpts {
|
||||
/** How long to wait (in milliseconds) until aborting the request. */
|
||||
timeout?: number;
|
||||
/** Event limit for the whole subscription. */
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export type { DittoFilter, GetFiltersOpts };
|
||||
|
|
Loading…
Reference in New Issue