rails/turbolinks — pull request #361 by devlinzed (2014-04-09 02:12:02+00:00)
Title: Pass the XHR object along `page:load`

This provides us with more information about the new page, such as its headers and URL. This can be used to integrate, for example, header-based JavaScript dispatch logic:

```ruby
before_filter :set_action

private def set_action
headers['X-Action'] = action_name
end
```

```javascript
document.addEventListener('page:load', function(event) {
var xhr = event.data;
if (xhr.getResponseHeader('X-Action') === 'edit') {
alert("You're editing something");
}
});
```