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.Proxy extends Batman.Object but implements the default accessor to get, set, and unset on its target.

Any accessors without explicit definitions will be delegated to target:

test "a Batman.Proxy delegates to its target", ->
  class CustomProxy extends Batman.Proxy
    @accessor 'customValue', -> "Custom Value!"

  targetObject = new Batman.Object({name: "Batman", favoriteColor: "#000"})
  proxy = new CustomProxy(targetObject)

  equal proxy.get('favoriteColor'), '#000', "Default accessor delegates to target"
  equal proxy.get('customValue'), "Custom Value!", "Custom accessors override delegated ones"

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.