Batman.js is no longer in production at Shopify and is not actively maintained.

This website is left for reference (and for old times' sake).

batman.js

Batman.Transaction is mixed into the new record created by Batman.Model::transaction. It redefines and adds a few functions so that the resulting "transaction" will behave like a model. For example:

product = new App.Product(name: "Orange Glo")
productTransaction = product.transaction()
productTransaction.set("name", "Sham-Wow")
# Changing the transaction doesn't affect the base record:
product.get('name') # "Orange Glo"
# Until changes are applied:
productTransaction.save()
product.get('name') # "Sham-Wow"

Help us improve our documentation!

Contributions to this page are welcome on Github. If you find a problem but you cannot fix it, please open an issue.

Discussion regarding batman.js documentation is also welcome on our mailing list.