Last Updated: February 25, 2016
· adamyanalunas

Re-fire one-shot events in Batman.js

If you use Batman.js as a front-end framework then you know the documentation is horrible. By now you'll also know that the "ready" state on a view is a one-shot event that never gets re-fired, even if the view's HTML or contents are changed out – calling view.fire 'ready' simply does nothing.

Unless you use this undocumented but public reset method resetOneShot:

someView = new Batman.View
# ... snip, but imagine "ready" was already fired ...
someView.fire 'ready' # Does nothing
someView.fire 'ready' # 'ready' event is fired

The only reasonable way to learn how to actually use Batman.js is to pour through the source code and the tests. Really, the tests are where you'll get some useful information.

2 Responses
Add your response


Good looking out. Thanks.

Come downtown sometime and I'll buy you a beer.

over 1 year ago ·