Skip to content

Commit 14ebec0

Browse files
committed
Update pm_on_purchase.js
1 parent 6275068 commit 14ebec0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

examples/pm_on_purchase.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,20 @@ Thanks,
2222
- Author`;
2323

2424
async function init() {
25+
// Initialise wrapper and exit if a failure occurs.
2526
let init = await wrapper.init(token);
2627
if (init.result === "error") {
2728
console.log(init.error);
2829
process.exit(0);
2930
}
3031

32+
// Poll once every hour.
3133
task();
3234
setInterval(task, 60 * 60 * 1000);
3335
}
3436

3537
async function task() {
36-
let purchases = await wrapper.resources.purchases.list_until(resource_id, function (purchase) {
38+
let purchases = await wrapper.resources.purchases.list_until(resource_id, (purchase) => {
3739
return purchase.purchase_id > last_purchase_id;
3840
});
3941

0 commit comments

Comments
 (0)