Moved Bundle.autoFreezable creation in the attempt of creating the bundle after processing promises and leveraging event loop

This commit is contained in:
Alexander Cerutti
2021-09-18 23:23:03 +02:00
parent 658bb287a8
commit 37b7b8698f

View File

@@ -86,12 +86,12 @@ export class PKPass extends Bundle {
);
}
const bundle = Bundle.autoFreezable("application/vnd.apple.pkpasses");
const buffers = await Promise.all(
passes.map((pass) => pass.getAsBuffer()),
);
const bundle = Bundle.autoFreezable("application/vnd.apple.pkpasses");
for (let i = 0; i < buffers.length; i++) {
bundle.addBuffer(`packed-pass-${i + 1}.pkpass`, buffers[i]);
}