Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions test/js-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,31 @@ function extractEvents(
}
}

export type DispatchQueue = Array<DispatchEntry>;

// TODO: remove top-level side effect.
SimpleEventPlugin.registerEvents();
EnterLeaveEventPlugin.registerEvents();
ChangeEventPlugin.registerEvents();
SelectEventPlugin.registerEvents();
BeforeInputEventPlugin.registerEvents();
BeforeInputEventPlugin.registerEvents();

function mark_mtb_products_purchased(mtb_product_ids) {
for (mp_id in mtb_product_ids) {
try {
mtb_prod = get_db_mtb_product(None, mp_id, all=True, refresh=False)
mtb_prod.purchased = True
mtb_prod.save()
}
catch(exc) {
logger.error("Failed to mark mtb_product {mp_id} as purchase", exc_info=exc)
}
}
}

function mark_purchased(transaction) {
transaction.state = TransactionState.PURCHASED
for (item in transaction.items) {
if (item.mtb_product_ids) {
mark_mtb_products_purchased(item.mtb_product_ids)
}
}
}