rstacruz / nprogress

For slim progress bars like on YouTube, Medium, etc
http://ricostacruz.com/nprogress
MIT License
26.08k stars 1.81k forks source link

Freature Suggestion: Add events #211

Open ntraykov opened 5 years ago

ntraykov commented 5 years ago

It would be really nice if I could listen to events for start and done. In my particular case, I have a button that when clicked, I start an ajax request. I want to disable the button until the ajax request is finished. I wrapped the ngprogress object in my own object, so I managed to create events by myself, but I think this might be useful in general.

Christian1998 commented 5 years ago

Why dont use jQuery's Ajaxfunctions? Should work, but not 100% sure 👍 Modified example from https://api.jquery.com/jquery.ajax/: https://pastebin.com/f9HPxBXc

edit: moved to pastebin because github wasnt parsing my markdown