Created
April 14, 2014 21:38
-
-
Save rmosolgo/10684525 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Loader = | |
| show: -> | |
| hide: -> | |
| window.activeXhrCount = 0 | |
| window.globalLoaderEnabled = true | |
| $(document).ajaxSend -> | |
| window.activeXhrCount++ | |
| Loader.show() | |
| .ajaxComplete -> | |
| window.activeXhrCount-- | |
| Loader.hide() | |
| .ajaxError (event, jqXHR, ajaxSettings, error) -> | |
| if error isnt 'abort' | |
| alert 'Uh oh! There seems to have been a problem.' | |
| window.activeXhrCount-- | |
| Loader.hide() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment