Sha256: 5f039289a843cb264ea4774dda563bf59ba5b7311c9dc7ea13e76c869e039304

Contents?: true

Size: 478 Bytes

Versions: 3

Compression:

Stored size: 478 Bytes

Contents

class Transponder.Response
  payload: {}

  constructor: ->
    $(document).ajaxComplete (event, xhr, status) =>
      if xhr.getResponseHeader('Content-Type') is 'application/transmission'
        @payload.raw = JSON.parse(@cleanContent(xhr.responseText))
        element    = @payload.raw[0]
        event_name = @payload.raw[1]
        content    = @payload.raw[2]

        $(element).trigger(event_name, content)

  cleanContent: (content) ->
    content.replace(/'/g, '"');

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
transponder-0.10.2 lib/assets/javascripts/transponder/response.coffee
transponder-0.10.1 lib/assets/javascripts/transponder/response.coffee
transponder-0.9.6 lib/assets/javascripts/transponder/response.coffee