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.SetObserver is a utility for observing Batman.Sets and their contents (especially if their contents are Batman.Objects). It extends Batman.Object. In the wild, Batman.SetProxy uses a Batman.SetObserver to track its base set and Batman.SetSort uses item tracking to maintain its order.

A few other points about Batman.SetObserver:

  • It fires itemsWereAdded and itemsWereRemoved when its base Batman.Set fires those events.
  • When items are added and removed to the base Set, they're automatically observed with startObservingItems/stopObservingItems -- you don't have to set that up yourself.
  • Override observedItemKeys and observerForItemAndKey to track properties of Batman.Object members of the set.

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.