angular-http-decelerator

A lightweight HTTP interceptor for AngularJS to slow down HTTP responses
Homepage:
0 people use it
Author: 1859381?v=3 jvandemo

HTTP decelerator for AngularJS

A lightweight HTTP interceptor for AngularJS that allows you to slow down HTTP responses provided by $http.

Features:

  • Plug and play: requires no changes to your code!
  • Supports milliseconds e.g. slow down HTTP responses by 2000ms
  • Supports percentages e.g. slow down HTTP responses by 300%
  • Logs deceleration to the console for debugging purposes

Why use it?

During development of your AngularJS application it is often hard to see how your application deals with slow HTTP responses.

Example: a loader shown when a form is posting data is not working correctly but you can't see it because the response gets in too quickly and the loader is hidden too fast.

HTTP decelerator conveniently allows you to simulate a slow connection without changing your own code so you can control the speed of the responses.

Installation

First install the package using Bower:

then include the file in your scripts:

and finally add the module to your AngularJS application:

Decelerate requests

To decelerate requests, add httpDecelerator to $httpProvider.interceptors like this:

By default, HTTP decelerator will decelerate all HTTP responses by 1000ms, but you can easily change this behavior.

Use milliseconds:

Use percentages:

History

v2.0.0

  • Refactor distribution names for better compatibility with official angular packages

v1.1.0

  • Add support for percentages
  • Add support for strings with 'ms' for easier reading

v1.0.0

  • Used in production so bump to v1.0.0

v0.3.0

  • Refactor as provider
  • Add more detailed logging

v0.2.0

  • Add deceleration logging

v0.1.0

  • Initial working version

License

MIT

comments powered by Disqus
This page was last updated about 3 years ago.