@gmod/bbi
Version:
Parser for BigWig/BigBed files
33 lines (32 loc) • 1.06 kB
TypeScript
export declare class AbortError extends Error {
code: string;
constructor(message: string);
}
interface Block {
offset: number;
length: number;
}
export declare function groupBlocks(blocks: Block[]): {
blocks: Block[];
length: number;
offset: number;
}[];
/**
* Properly check if the given AbortSignal is aborted. Per the standard, if the
* signal reads as aborted, this function throws either a DOMException
* AbortError, or a regular error with a `code` attribute set to `ERR_ABORTED`.
*
* For convenience, passing `undefined` is a no-op
*
* @param {AbortSignal} [signal] an AbortSignal, or anything with an `aborted` attribute
* @returns nothing
*/
export declare function checkAbortSignal(signal?: AbortSignal): void;
/**
* Skips to the next tick, then runs `checkAbortSignal`.
* Await this to inside an otherwise synchronous loop to
* provide a place to break when an abort signal is received.
* @param {AbortSignal} signal
*/
export declare function abortBreakPoint(signal?: AbortSignal): Promise<void>;
export {};