From 2a805b0f40cc4e98e4cf0b18c6a60c423dd135d4 Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Mon, 3 Oct 2022 19:33:23 +0800 Subject: [PATCH] rename Response > SourceData --- js/v3.test.ts | 4 ++-- js/v3.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/js/v3.test.ts b/js/v3.test.ts index 5f97c4a..f7217ad 100644 --- a/js/v3.test.ts +++ b/js/v3.test.ts @@ -14,7 +14,7 @@ import { Cache, BufferPosition, Source, - Response, + SourceData, VersionMismatch, PMTiles, } from "./v3"; @@ -135,7 +135,7 @@ class TestNodeFileSource implements Source { async getBytes( offset: number, length: number - ): Promise { + ): Promise { const slice = new Uint8Array(this.buffer.slice(offset, offset + length)) .buffer; return {data:slice, etag:this.etag}; diff --git a/js/v3.ts b/js/v3.ts index 472a7df..5283f3c 100644 --- a/js/v3.ts +++ b/js/v3.ts @@ -213,7 +213,7 @@ export function findTile(entries: Entry[], tileId: number): Entry | null { return null; } -export interface Response { +export interface SourceData { data: ArrayBuffer; etag?: string; expires?: string; @@ -227,7 +227,7 @@ export interface Source { offset: number, length: number, signal?: AbortSignal - ) => Promise; + ) => Promise; getKey: () => string; } @@ -243,7 +243,7 @@ export class FileAPISource implements Source { return this.file.name; } - async getBytes(offset: number, length: number): Promise { + async getBytes(offset: number, length: number): Promise { const blob = this.file.slice(offset, offset + length); const a = await blob.arrayBuffer(); return { data: a }; @@ -265,7 +265,7 @@ export class FetchSource implements Source { offset: number, length: number, signal?: AbortSignal - ): Promise { + ): Promise { let controller; if (!signal) { // TODO check this works or assert 206 @@ -545,7 +545,7 @@ export class PMTiles { x: number, y: number, signal?: AbortSignal - ): Promise { + ): Promise { const tile_id = zxyToTileId(z, x, y); const header = await this.cache.getHeader(this.source); @@ -594,7 +594,7 @@ export class PMTiles { x: number, y: number, signal?: AbortSignal - ): Promise { + ): Promise { try { return await this.getZxyAttempt(z, x, y, signal); } catch (e) {