diff --git a/js/CHANGELOG.md b/js/CHANGELOG.md index 4a8298e..2124000 100644 --- a/js/CHANGELOG.md +++ b/js/CHANGELOG.md @@ -1,3 +1,24 @@ +2.0.0 + +* Major version bump, changing the JS API. +* Support for PMTiles spec version 3 archives. +* Backwards compatibility with v2 archives. +* Leaflet and MapLibre adapters support tile cancellation, improving performance significantly. +* ETag and Retry support for archives that are updated in-place. +* Cache-Control and Expires header support for MapLibre. + +Clearer API names: + +```js + const p = new pmtiles.PMTiles('example.pmtiles') + pmtiles.leafletRasterLayer(p).addTo(map) +``` +```js + let protocol = new pmtiles.Protocol(); + maplibregl.addProtocol("pmtiles",protocol.tile); +``` + + 1.0.0 * Breaking change, introducing new TypeScript module with more clearly defined interfaces. diff --git a/js/README.md b/js/README.md index dd5684d..fcdc038 100644 --- a/js/README.md +++ b/js/README.md @@ -10,7 +10,7 @@ Example of a raster PMTiles archive displayed in Leaflet: ```js const p = new pmtiles.PMTiles('example.pmtiles') -pmtiles.leafletLayer(p,{attribution:'© OpenStreetMap contributors'}).addTo(map) +pmtiles.leafletRasterLayer(p,{attribution:'© OpenStreetMap contributors'}).addTo(map) ```` ### Vector tileset @@ -22,8 +22,8 @@ pmtiles.leafletLayer(p,{attribution:'© Open Example of a PMTiles archive displayed in MapLibre GL JS: ```js -let cache = new pmtiles.ProtocolCache(); -maplibregl.addProtocol("pmtiles",cache.protocol); +let protocol = new pmtiles.Protocol(); +maplibregl.addProtocol("pmtiles",protocol.tileFunc); var style = { "version": 8, "sources": { diff --git a/js/adapters.ts b/js/adapters.ts index d335b21..a2b7855 100644 --- a/js/adapters.ts +++ b/js/adapters.ts @@ -61,7 +61,7 @@ export class Protocol { return this.tiles.get(url); } - tileFunc = (params: any, callback: any) => { + tile = (params: any, callback: any) => { const re = new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/); const result = params.url.match(re); const pmtiles_url = result[1]; diff --git a/js/package.json b/js/package.json index fd5ba54..cbc1ca3 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "pmtiles", - "version": "1.1.0", + "version": "2.0.0", "description": "PMTiles archive decoder for browsers", "main": "dist/index.cjs", "module": "dist/index.mjs",