app/assets/javascripts/s3_relay.coffee in s3_relay-0.1.0 vs app/assets/javascripts/s3_relay.coffee in s3_relay-0.2.0
- old
+ new
@@ -2,10 +2,15 @@
if progressColumn
progressColumn.text("File could not be uploaded")
else
alert("File could not be uploaded")
+publishEvent = (name, detail) ->
+ ev = document.createEvent "CustomEvent"
+ ev.initCustomEvent name, true, false, detail
+ document.dispatchEvent ev
+
saveUrl = (container, uuid, filename, contentType, publicUrl) ->
privateUrl = null
$.ajax
type: "POST"
@@ -19,9 +24,10 @@
filename: filename
content_type: contentType
public_url: publicUrl
success: (data, status, xhr) ->
privateUrl = data.private_url
+ publishEvent "upload:success", { uuid: uuid }
error: (xhr) ->
console.log xhr.responseText
return privateUrl