Sha256: be7006b5e002aee16ece7517ea78d99052c939e71b36944f7b879bd2533a7052

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

#= require trix/watchdog/recording
#= require trix/watchdog/player_controller

Trix.registerElement "trix-watchdog-player",
  defaultCSS: """
    %t > div { display: -webkit-flex; display: flex; font-size: 14px; margin: 10px 0 }
    %t > div > button { width: 65px }
    %t > div > input { width: 100%; -webkit-align-self: stretch; align-self: stretch; margin: 0 20px }
    %t > div > span { display: inline-block; text-align: center; width: 110px }
  """

  attachedCallback: ->
    if url = @getAttribute("src")
      @fetchRecordingAtURL(url)

  attributeChangedCallback: (attributeName, oldValue, newValue) ->
    if attributeName is "src"
      @fetchRecordingAtURL(newValue)

  fetchRecordingAtURL: (url) ->
    @activeRequest?.abort()
    @activeRequest = new XMLHttpRequest
    @activeRequest.open("GET", url)
    @activeRequest.send()
    @activeRequest.onload = =>
      json = @activeRequest.responseText
      @activeRequest = null
      recording = Trix.Watchdog.Recording.fromJSON(JSON.parse(json))
      @loadRecording(recording)

  loadRecording: (recording) ->
    @controller = new Trix.Watchdog.PlayerController this, recording

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vapid-0.1.3 lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_element.coffee
vapid-0.1.2 lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_element.coffee
vapid-0.1.1 lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_element.coffee
vapid-0.1.0 lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_element.coffee