Sha256: 09b28e87f08c309fd6cded4e605adc87b7cab0b0dd856d8e7ade82601e67e8b9

Contents?: true

Size: 485 Bytes

Versions: 3

Compression:

Stored size: 485 Bytes

Contents

class Transponder.Response
  payload: {}

  constructor: ->
    $(document).on 'ajax:complete', (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.9.5 lib/assets/javascripts/transponder/response.coffee
transponder-0.9.4 lib/assets/javascripts/transponder/response.coffee
transponder-0.9.3 lib/assets/javascripts/transponder/response.coffee