From 37b7b8698f9f4f6b8be69027f7c44259b32ca156 Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Sat, 18 Sep 2021 23:23:03 +0200 Subject: [PATCH] Moved Bundle.autoFreezable creation in the attempt of creating the bundle after processing promises and leveraging event loop --- src/PKPass.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PKPass.ts b/src/PKPass.ts index b83799f..99df1fc 100644 --- a/src/PKPass.ts +++ b/src/PKPass.ts @@ -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]); }