mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
cleanup PMTiles constructor; metadata returns Promise
This commit is contained in:
@@ -35,7 +35,7 @@ const bytesToMap = dataview => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PMTiles {
|
export class PMTiles {
|
||||||
constructor(url, options = {}) {
|
constructor(url) {
|
||||||
this.url = url
|
this.url = url
|
||||||
const controller = new AbortController()
|
const controller = new AbortController()
|
||||||
const signal = controller.signal
|
const signal = controller.signal
|
||||||
@@ -60,8 +60,10 @@ export class PMTiles {
|
|||||||
}
|
}
|
||||||
|
|
||||||
metadata = func => {
|
metadata = func => {
|
||||||
this.root.then(root => {
|
return new Promise((resolve,reject) => {
|
||||||
func(root.metadata)
|
this.root.then(root => {
|
||||||
|
resolve(root.metadata)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user