Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maplibre.Offlinemanager async call problem #443

Open
szk5 opened this issue Sep 13, 2024 · 1 comment
Open

Maplibre.Offlinemanager async call problem #443

szk5 opened this issue Sep 13, 2024 · 1 comment

Comments

@szk5
Copy link

szk5 commented Sep 13, 2024

Hello,

We found a strange thing (maybe a bug?), when we tried to use MapLibreGL.offlineManager.createPack function.

Example code snippet:
await MapLibreGL.offlineManager.createPack({
name: 'offline',
styleURL: OFFLINE_MAP,
bounds: offlineBBox,
minZoom: 5,
maxZoom: 22
}, (pack, progressStatus) => {
console.log(progressStatus.percentage);
}, (err) => {
console.log("Error happened");
});
console.log("When I called");

We call this code snipppet from async function.
The problem is the following. "When I called" console.log is the first thing, which was written to console output instead of progress status.
We don't understand why don't wait "await" keyword the createPack async function return.

Thank you for your help.

@RobertSasak
Copy link
Contributor

The task of creating pack is done. But it does not mean the pack is downloaded. I think this is intentional behaviour as the user might anyway leave the app while the pack is downloading. So it is not a reliable to wait for if anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants