How to make use of Active Storage javascript events

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to make use of Active Storage javascript events

Shairyar Baig

I am reading the Active Storage documentation available here and I am trying to find out how to display a progress bar. Just to test I added the following code inside my application.js

The image gets uploaded on amazon just fine but I see nothing in browser's console

	addEventListener("direct-upload:initialize", doSomething, false);

	function doSomething(e) {
		alert("Event is called: " + e.type);
	}

I also tried this but I do not see anything in console.

document.getElementById("image_form").addEventListener("direct-upload:initialize", function() {
  console.log('direct-uploads:initialize')
});

document.getElementById("image_form").addEventListener("direct-uploads:end", function() {
  console.log('direct-uploads:start')
});

I would like to know how to make use of the events available? 


Any help will be really appreciated as I am really stuck and cant find any material on how to do this.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/70f36783-8c1a-4854-b797-5075eadef0a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.