From 41dda77cbdf7c749c7e2f8b4dd5abba9019f16cd Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Fri, 30 Apr 2021 18:21:26 +0800 Subject: [PATCH] cleanup PMTiles constructor; metadata returns Promise --- js/index.mjs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/index.mjs b/js/index.mjs index fcfe105..ccdd6fe 100644 --- a/js/index.mjs +++ b/js/index.mjs @@ -35,7 +35,7 @@ const bytesToMap = dataview => { } export class PMTiles { - constructor(url, options = {}) { + constructor(url) { this.url = url const controller = new AbortController() const signal = controller.signal @@ -60,8 +60,10 @@ export class PMTiles { } metadata = func => { - this.root.then(root => { - func(root.metadata) + return new Promise((resolve,reject) => { + this.root.then(root => { + resolve(root.metadata) + }) }) }