@gmod/nclist
Version:
Read features from JBrowse 1 format nested containment list JSON
31 lines (30 loc) • 1.19 kB
TypeScript
/**
* For a JSON array that gets too large to load in one go, this class
* helps break it up into chunks and provides an
* async API for using the information in the array.
*/
export default class LazyArray {
constructor({ urlTemplate, chunkSize, length, cacheSize, readFile }: {
urlTemplate: any;
chunkSize: any;
length: any;
cacheSize?: number | undefined;
readFile: any;
}, baseUrl: any);
/**
* call the callback on one element of the array
* @param i index
* @param callback callback, gets called with (i, value, param)
* @param param (optional) callback will get this as its last parameter
*/
index(i: any, callback: any, param: any): void;
/**
* async generator for the elements in the range [start,end]
*
* @param start index of first element to call the callback on
* @param end index of last element to call the callback on
*/
range(start: any, end: any): AsyncGenerator<any[], void, unknown>;
getChunk(chunkNumber: any): Promise<any[]>;
filterChunkData(queryStart: any, queryEnd: any, chunkNumber: any, chunkData: any): Generator<any[], void, unknown>;
}