Closed sja closed 7 years ago
You can use await
only inside an async
function. Are you doing so?
Basically, it's like this
const { Template } = require('@destinationstransfers/passkit');
async function initTemplate() {
const template = new Template('boardingPass');
await template.images.loadFromDirectory('imagesDirectory');
}
// somewhere later you call the initTemplate or do something like this:
setImmediate(initTemplate);
I do recommend consider Template.load
- that loads images and all template fields from pass.json
. We will support localizations load soon too.
Ah, great! Thanks. I always used Kris Kowalls Q, not the "native" promises. And IntelliJ had no helpful hint on that: Expression statement is not assignment or call
Thanks for the fast reply!
I'm using NodeJS 8.3.0 and I get the following error: