Sha256: c3932ec699fe6e741bf611895cc5739bd1faa9ec4f03d785a539f92ebf5837fc

Contents?: true

Size: 733 Bytes

Versions: 1

Compression:

Stored size: 733 Bytes

Contents

# Xray Backbone integration. This involves hooking into the lifecycle
# of Backbone.View by monkey patching its prototype. Would love a cleaner
# way of doing this, as nobody wants to this stuff in their stack traces.

return unless window.Backbone && window.Xray

# Wrap Backbone.View::_ensureElement to add the view to Xray once
# its element has been setup.
_ensureElement = Backbone.View::_ensureElement
Backbone.View::_ensureElement = ->
  _.defer =>
    info = Xray.constructorInfo @constructor
    Xray.ViewSpecimen.add @el, info
  _ensureElement.apply(this, arguments)

# Cleanup when view is removed.
_remove = Backbone.View::remove
Backbone.View::remove = ->
  Xray.ViewSpecimen.remove @el
  _remove.apply(this, arguments)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xray-rails-0.1.1 app/assets/javascripts/xray-backbone.js.coffee