diff --git a/js/examples/leaflet.html b/js/examples/leaflet.html index 09015d9..7be4ca0 100644 --- a/js/examples/leaflet.html +++ b/js/examples/leaflet.html @@ -15,17 +15,16 @@
diff --git a/js/src/adapters.ts b/js/src/adapters.ts index e1cd829..b0e67f0 100644 --- a/js/src/adapters.ts +++ b/js/src/adapters.ts @@ -77,6 +77,7 @@ export const leafletRasterLayer = (source: PMTiles, options: unknown) => { } if (tile.el.cancel) tile.el.cancel(); + if (tile.el.src) window.URL.revokeObjectURL(tile.el.src); tile.el.width = 0; tile.el.height = 0; @@ -256,7 +257,6 @@ export class Protocol { const x = result[3]; const y = result[4]; - const header = await instance.getHeader(); const resp = await instance?.getZxy(+z, +x, +y, abortController.signal); abortController.signal.throwIfAborted(); if (resp) { @@ -266,6 +266,7 @@ export class Protocol { expires: resp.expires, }; } + const header = await instance.getHeader(); if (header.tileType === TileType.Mvt) { if (this.errorOnMissingTile) { throw new Error("Tile not found."); diff --git a/js/src/index.ts b/js/src/index.ts index 4981b52..7a2121b 100644 --- a/js/src/index.ts +++ b/js/src/index.ts @@ -551,23 +551,6 @@ function deserializeIndex(buffer: ArrayBuffer): Entry[] { return entries; } -function detectVersion(a: ArrayBuffer): number { - const v = new DataView(a); - if (v.getUint16(2, true) === 2) { - console.error( - "PMTiles spec version 2 is not supported; please see github.com/protomaps/PMTiles for tools to upgrade" - ); - return 2; - } - if (v.getUint16(2, true) === 1) { - console.error( - "PMTiles spec version 1 is not supported; please see github.com/protomaps/PMTiles for tools to upgrade" - ); - return 1; - } - return 3; -} - /** * Error thrown when a response for PMTiles over HTTP does not match previous, cached parts of the archive. * The default PMTiles implementation will catch this error once internally and retry a request.